Adobe Systems, Inc.

SlideShowMetadata.as

Go to the documentation of this file.
00001 /****************************************
00002 ** Copyright 2005-2006 Adobe Systems Incorporated
00003 ** Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
00004 ** or a copy at http://opensource.adobe.com/licenses.html)
00005 **
00006 ** SlideShowViewMetadata Class 
00007 ****************************************/
00008 import flash.filters.DropShadowFilter;
00009 class amg.SlideShowMetadata extends MovieClip {
00010         
00011         public var txtField:TextField;
00012         private var _iTextFieldSideSpacer = 12;
00013         private var _btnUp:MovieClip;
00014         private var _btnDown:MovieClip;
00015         private var _bButtonHold:Boolean = false;
00016         private var timeOutID:Number = -1;
00017         public var strTextVal:String;
00018         private var toolTip:MovieClip;
00019         
00020         //class constructor
00021         public function SlideShowMetadata() {
00022                 
00023                 
00024                 //text field
00025                 this.createTextField("txtField",this.getNextHighestDepth(),_iTextFieldSideSpacer,0,5,5);
00026                 this.txtField.html = true;
00027                 this.txtField.mouseWheelEnabled = true;
00028                 this.txtField.multiline = true;
00029                 this.txtField.wordWrap = true;
00030                 this.txtField.antiAliasType = "advanced";
00031                 this.txtField.border = false;
00032                 this.txtField.selectable = true;
00033                 
00034                 //send the name of the text field clicked when in livePreview mode
00035                 if(_root.PreviewInLightroom){
00036                         this.onPress = function() {
00037                                 var textStyle = this.txtField.styleSheet.getStyle("textStyle")
00038                                 _root.UIElementClick("SlideShowMetadata",this._x,this._y,this._height,this._width, textStyle.fontFamily, textStyle.fontSize, textStyle.textAlign);
00039                         };
00040                 }
00041                 
00042                 this.txtField.onSetFocus = function (oldFocus:Object,newFocus:Object) {
00043                         if(newFocus != null)
00044                                 _root.gallery.suspendKeyboard();
00045                         else
00046                                 _root.gallery.resumeKeyboard();
00047                         
00048                 }
00049                 
00050                 Selection.addListener(this.txtField);
00051                 
00052                 Mouse.addListener(this.txtField);
00053                 
00054                 //buttons
00055                 this._btnDown = attachMovie("ImageViewCaptionBtnDown","downButton",this.getNextHighestDepth(),{_visible:false});
00056                 this._btnUp = attachMovie("ImageViewCaptionBtnUp","upButton",this.getNextHighestDepth(),{_visible:false});
00057                 
00058         }
00059         
00060 
00061         
00062         public function setTextValue(strNewVal:String):Void{
00063                 this.strTextVal = strNewVal;
00064                 this.txtField.htmlText = strNewVal;
00065 
00066                 if(this.txtField.textHeight >= this._height){
00067                         this._btnUp._visible = true;
00068                         this._btnDown._visible = true;
00069                 }
00070                 else {
00071                         this._btnUp._visible = false;
00072                         this._btnDown._visible = false;
00073                 }
00074         }
00075         
00076         
00077         public function clearScrollButtons():Void{
00078                 this._btnUp._visible = false;
00079                 this._btnDown._visible = false;
00080         }
00081         
00082         public function setHeightWidth(h:Number,w:Number){
00083                 this.txtField._height = h;
00084                 this.txtField._width = w-(_iTextFieldSideSpacer*2)-6;
00085                 
00086                 if((h>0) && (this.txtField.textHeight >= (this._height-1))){
00087                         this._btnUp._x = this._btnDown._x = w - this._btnUp._width  + 0.5;
00088                         this._btnUp._y = 2;
00089                         this._btnDown._y = this._height - this._btnDown._height-2;
00090                         this._btnUp._visible = true;
00091                         this._btnDown._visible = true;
00092                 }
00093                 else {
00094                         this._btnUp._visible = false;
00095                         this._btnDown._visible = false;
00096                 }
00097         }
00098         
00099         private function scrollUp():Void{
00100                 this.txtField.scroll--;
00101                 this._bButtonHold = true;
00102                 if(this.timeOutID == -1)
00103                         this.timeOutID = setInterval(this,"autoScroll",900,"up");
00104         }
00105         
00106         private function scrollDown():Void{
00107                 this.txtField.scroll++;
00108                 this._bButtonHold = true;
00109                 if(this.timeOutID == -1)
00110                         this.timeOutID = setInterval(this,"autoScroll",900,"down");
00111         }
00112         
00113         private function scrollRelease():Void{
00114                 this._bButtonHold = false;
00115         }
00116         
00117         private function autoScroll(dir:String):Void {
00118                 clearInterval(this.timeOutID);
00119                 if(this._bButtonHold){
00120                         if(dir=="up")
00121                                 this.txtField.scroll--;
00122                         else
00123                                 this.txtField.scroll++;
00124                         this.timeOutID = setInterval(this,"autoScroll",50,dir);
00125                 }
00126                 else {
00127                         this.timeOutID = -1;
00128                 }
00129         }
00130         
00131         
00132         
00133         
00134 
00135 }

Copyright © 2006 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.