Adobe Systems, Inc.

GalleryInfo.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 ** GalleryInfo Class 
00007 ********************************************************************/
00008 
00009 import mx.xpath.XPathAPI;
00010 import amg.*;
00011 
00012 //implements ISmartLoader interface insuring that the smartLoader callback method is present
00013 class amg.GalleryInfo extends MovieClip {
00014         //member properties
00015         private var _iControlWidth:Number;
00016         private var _iControlHeight:Number;
00017         private var Background:MovieClip;
00018         private var ScrollingField:MovieClip;
00019         public var widthPercentage:Number;
00020         private var _iMarginSpacer:Number = 6;
00021         public var iBorderColor:Number;
00022         public var iBorderAlpha:Number;
00023         public var iBgColor:Number;
00024         public var iBgAlpha:Number;
00025         
00026         
00027         //class constructor
00028         public function GalleryInfo() {
00029                 
00030                 this.Background = this.attachMovie("ScrollingFieldBg", "Background", this.getNextHighestDepth());
00031                 this.ScrollingField = this.attachMovie("ScrollingField","ScrollingField",this.getNextHighestDepth(),{_visible:true});
00032                 this.ScrollingField.setFieldName("GalleryInfo");
00033                 
00034         }
00035         
00036         public function setText(newText:XMLNode):Void {
00037                 this.ScrollingField.txtField.htmlText = newText;
00038         }
00039 
00040         
00041         public function setHeightWidth(h:Number, w:Number):Void {
00042                 this._iControlWidth = w;
00043                 this._iControlHeight = h;
00044                 
00045                 this.ScrollingField._x = this._iMarginSpacer;
00046                 this.ScrollingField._y =  this._iMarginSpacer;
00047                 
00048                 this.ScrollingField.setHeightWidth(h-this.ScrollingField._y-this._iMarginSpacer,w-10);
00049                 this.Background.drawRectangle(w,h,7);
00050                 
00051 
00052         }
00053         
00054         
00055         
00056         public function parseStyleXML(styleNode:XMLNode):Void {
00057                 
00058                 var xmlGalleryInfoBgFill:XMLNode = XPathAPI.selectSingleNode(styleNode,"/galleryInfo/galleryInfoBgColor");
00059                 var xmlGalleryInfoBorder:XMLNode = XPathAPI.selectSingleNode(styleNode,"/galleryInfo/galleryInfoBorder");
00060                 var xmlGalleryTextField:XMLNode = XPathAPI.selectSingleNode(styleNode,"/galleryInfo/galleryInfoTextField");
00061                 var xmlGalleryInfoText:XMLNode = XPathAPI.selectSingleNode(styleNode,"/galleryInfo/galleryInfoText");
00062                 //ScrollBars
00063                 var xmlGalleryInfoScrollBarFill:XMLNode = XPathAPI.selectSingleNode(styleNode,"/galleryInfo/galleryInfoScrollBars/galleryInfoScrollBarFill");
00064                 var xmlGalleryInfoScrollBarFore:XMLNode = XPathAPI.selectSingleNode(styleNode,"/galleryInfo/galleryInfoScrollBars/galleryInfoScrollBarFore");
00065                 var xmlGalleryInfoScrollBarBorder:XMLNode = XPathAPI.selectSingleNode(styleNode,"/galleryInfo/galleryInfoScrollBars/galleryInfoScrollBarBorder");
00066                 
00067                 this.iBorderColor = parseInt("0x"+xmlGalleryInfoBorder.attributes.color);
00068                 this.iBorderAlpha =parseInt(xmlGalleryInfoBorder.attributes.alpha);
00069                 this.iBgColor = parseInt("0x"+xmlGalleryInfoBgFill.attributes.color);
00070                 this.iBgAlpha =parseInt(xmlGalleryInfoBgFill.attributes.alpha);
00071                 
00072                 this.Background.setColors(0,this.iBorderColor,this.iBorderAlpha,this.iBgColor,this.iBgAlpha);           
00073 
00074                 //Right Scroll Button
00075                 setTint(this.ScrollingField.ScrollBtnUp.BtnFore,xmlGalleryInfoScrollBarFore.attributes.color,xmlGalleryInfoScrollBarFore.attributes.alpha);
00076                 setTint(this.ScrollingField.ScrollBtnUp.BtnBorder,xmlGalleryInfoScrollBarBorder.attributes.color,xmlGalleryInfoScrollBarBorder.attributes.alpha);
00077                 setTint(this.ScrollingField.ScrollBtnUp.BtnBg,xmlGalleryInfoScrollBarFill.attributes.color,xmlGalleryInfoScrollBarFill.attributes.alpha); 
00078                 //Left Scroll Button
00079                 setTint(this.ScrollingField.ScrollBtnDown.BtnFore,xmlGalleryInfoScrollBarFore.attributes.color,xmlGalleryInfoScrollBarFore.attributes.alpha);
00080                 setTint(this.ScrollingField.ScrollBtnDown.BtnBorder,xmlGalleryInfoScrollBarBorder.attributes.color,xmlGalleryInfoScrollBarBorder.attributes.alpha);
00081                 setTint(this.ScrollingField.ScrollBtnDown.BtnBg,xmlGalleryInfoScrollBarFill.attributes.color,xmlGalleryInfoScrollBarFill.attributes.alpha); 
00082                 //ScrollBar
00083                 setTint(this.ScrollingField.ScrollThumb.middle.ScrollThumbBgFill,xmlGalleryInfoScrollBarFore.attributes.color,xmlGalleryInfoScrollBarFore.attributes.alpha);
00084                 setTint(this.ScrollingField.ScrollThumb.cap1.EndCapBg,xmlGalleryInfoScrollBarFore.attributes.color,xmlGalleryInfoScrollBarFore.attributes.alpha);
00085                 setTint(this.ScrollingField.ScrollThumb.cap2.EndCapBg,xmlGalleryInfoScrollBarFore.attributes.color,xmlGalleryInfoScrollBarFore.attributes.alpha);
00086                 this.ScrollingField._iScrollBarBorder =  parseInt("0x"+xmlGalleryInfoScrollBarBorder.attributes.color);
00087                 this.ScrollingField._iScrollBarBorderAlpha = parseInt(xmlGalleryInfoScrollBarBorder.attributes.alpha);
00088                 this.ScrollingField._iScrollBarFill =  parseInt("0x"+xmlGalleryInfoScrollBarFill.attributes.color);
00089                 this.ScrollingField._iScrollBarFillAlpha = parseInt(xmlGalleryInfoScrollBarFill.attributes.alpha);
00090                 
00091                 this.ScrollingField.setStyle(xmlGalleryInfoText);
00092 
00093                 
00094         }
00095         
00096         public function livePreview(whichPart:String, styleNode:XMLNode):Void {
00097                 switch(whichPart) {
00098                         case "galleryInfoBgColor" :
00099                                 this.iBgColor = parseInt("0x"+styleNode.attributes.color);
00100                                 this.iBgAlpha = parseInt(styleNode.attributes.alpha);
00101                                 this.Background.setColors(0,this.iBorderColor,this.iBorderAlpha,this.iBgColor,this.iBgAlpha);
00102                                 break;
00103                         case "galleryInfoBorder" :
00104                                 this.iBorderColor = parseInt("0x"+styleNode.attributes.color);
00105                                 this.iBorderAlpha =parseInt(styleNode.attributes.alpha);
00106                                 this.Background.setColors(0,this.iBorderColor,this.iBorderAlpha,this.iBgColor,this.iBgAlpha);
00107                                 break;
00108                         case "galleryInfoText" :
00109                                 this.ScrollingField.setStyle(styleNode);
00110                                 break;
00111                         case "galleryInfoBtnBorder" :
00112                                 //Right Scroll Button
00113                                 this.setTint(this.ScrollingField.ScrollBtnUp.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
00114                                 this.setTint(this.ScrollingField.ScrollBtnDown.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
00115                                 this.setTint(this.ScrollingField.ScrollLine.ScrollLineBottom,styleNode.attributes.color,styleNode.attributes.alpha);
00116                                 this.setTint(this.ScrollingField.ScrollThumb.ScrollThumbBorder,styleNode.attributes.color,styleNode.attributes.alpha);
00117                                 break;
00118                         case "galleryInfoBtnBackground" :
00119                                 this.setTint(this.ScrollingField.ScrollBtnUp.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
00120                                 this.setTint(this.ScrollingField.ScrollBtnDown.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
00121                                 this.setTint(this.ScrollingField.ScrollLine.ScrollLineTop,styleNode.attributes.color,styleNode.attributes.alpha);
00122                                 this.setTint(this.ScrollingField.ScrollThumb.ScrollThumbBg.ScrollThumbBgFill,styleNode.attributes.color,styleNode.attributes.alpha);
00123                                 break;
00124                         case "galleryInfoBtnFore" :
00125                                 this.setTint(this.ScrollingField.ScrollBtnUp.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
00126                                 this.setTint(this.ScrollingField.ScrollBtnDown.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
00127                                 break;
00128                         case "thumbnailViewScrollBarFill" :
00129                                 
00130                                 setTint(this.ScrollingField.ScrollBtnUp.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
00131                                 setTint(this.ScrollingField.ScrollBtnDown.BtnBg,styleNode.attributes.color,styleNode.attributes.alpha);
00132                                 
00133                                 
00134                                 this.ScrollingField._iScrollBarFill = parseInt("0x"+styleNode.attributes.color);
00135                                 this.ScrollingField._iScrollBarFillAlpha = parseInt(styleNode.attributes.alpha);
00136                                 
00137                                 this.setHeightWidth(this._iControlHeight,this._iControlWidth)
00138                                 break;
00139                         case "thumbnailViewScrollBarFore" :
00140                                 setTint(this.ScrollingField.ScrollBtnUp.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
00141                                 setTint(this.ScrollingField.ScrollBtnDown.BtnFore,styleNode.attributes.color,styleNode.attributes.alpha);
00142                                 
00143                                 //thumb
00144                                 setTint(this.ScrollingField.ScrollThumb.middle.ScrollThumbBgFill,styleNode.attributes.color,styleNode.attributes.alpha);
00145                                 setTint(this.ScrollingField.ScrollThumb.cap1.EndCapBg,styleNode.attributes.color,styleNode.attributes.alpha);
00146                                 setTint(this.ScrollingField.ScrollThumb.cap2.EndCapBg,styleNode.attributes.color,styleNode.attributes.alpha);
00147                                 
00148                                 break;
00149                         case "thumbnailViewScrollBarBorder" :
00150                                 
00151                                 setTint(this.ScrollingField.ScrollBtnUp.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
00152                                 setTint(this.ScrollingField.ScrollBtnDown.BtnBorder,styleNode.attributes.color,styleNode.attributes.alpha);
00153                                 
00154                                 
00155                                 this.ScrollingField._iScrollBarBorder =  parseInt("0x"+styleNode.attributes.color);
00156                                 this.ScrollingField._iScrollBarBorderAlpha = parseInt(styleNode.attributes.alpha);
00157                                 
00158                                 this.setHeightWidth(this._iControlHeight,this._iControlWidth)
00159                                 break;
00160                 }
00161         }
00162         
00163         
00164         /**************************************************************
00165         ** setTint
00166         ** Sets a color object for a movieclip and then sets its tint
00167         ** allowing for ActionScript control of display colors
00168         ****************************************************************/
00169         function setTint(clip:MovieClip,hexval:String,alpha:String):Void {
00170                 hexval = "0x" + hexval;
00171                 var colorVal = parseInt(hexval);
00172                 var alphaVal = parseInt(alpha);
00173                 var color:Color = new Color(clip);
00174                 var oColorTransform:Object = new Object();
00175                 oColorTransform.ra = oColorTransform.ga = oColorTransform.ba   = 0;
00176                 oColorTransform.rb = (colorVal >> 16) & 0xFF;
00177                 oColorTransform.gb = (colorVal >> 8) & 0xFF;
00178                 oColorTransform.bb = colorVal & 0xFF;
00179                 oColorTransform.ab = ((alphaVal/100)*255)-255;
00180                 color.setTransform(oColorTransform);
00181         }
00182 
00183 }

Copyright © 2006 Adobe Systems Incorporated.

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