Adobe Systems, Inc.

Gallery.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 ** Gallery Class 
00007 **
00008 ** This is the main class for the whole application.
00009 ** It parses the localization, style and group xml files,
00010 ** instantiates all on-screen ActionScript objects,
00011 ** sizes and positions the gallery objects
00012 ** and acts as a central event disaptcher for intra object communication. 
00013 ********************************************************************/
00014 
00015 import mx.xpath.XPathAPI;
00016 import amg.*;
00017 import flash.external.*;
00018 
00019 class amg.Gallery extends MovieClip {
00020         //gallery properties
00021         private var _strVersionNumber = "AMG 2.2.0";                                    //version number
00022         private var _iMinScreenWidth:Number = 650;                                              //the min dimensions for the gallery
00023         private var _iMinScreenHeight:Number = 340;                                             //before the window will start to crop
00024         private var _strPageTitle:String = "Photo Gallery";                             //name of the gallery
00025         private var _strGroupTitle:String = "my Photos";                                //name of the media group
00026         private var _strGroupDesc:String;                                                               //shows up in the 'About' page
00027         public var strGroupID:String;                                                                   //the uuid of the media group
00028         private var _iMenuTabIndex = 10;                                                                //tab indicies for non-mouse browsing
00029         private var _iSlideshowControlTabIndex = 500;
00030         private var _iVideoControlIndex = 600;
00031         private var _iThumbsTabIndex = 700;
00032         
00033         //gallery options
00034         private var embedEnabled = false;                                                               //true if gallery is embedded in another env.
00035         private var _bDebugWindow:Boolean = false;                                              //debug mode enabled
00036         private var _strBaseRefUrl:String = "";                                                 //a string appended to file requests
00037         private var _iStartSlide:Number = 0;                                                    //an index into the media elements array
00038         private var _strViewMode:String = "galleryDefault";                             //dictates the layout of the gallery
00039         private var _strMetadataMode:String = "underPhotos";                    //where the media metadata is displayed
00040         private var _strCurrView:String = "gallery";                                    //which view the gallery is in
00041         private var _strCurrBandwidth:String = "broadband";                             //the bandwidth setting (affects media size)
00042         private var _currImageSize = "small";                                                   //the size of the image
00043         private var _strPlayMode:String = "paused";                                             //the state of the slideshow feature
00044         private var _iSlideDuration:Number = 5;                                                 //number in seconds between each slide
00045         private var _iTransitionDuration:Number = 0.75;                                 //number in seconds it takes to perform a slide transition
00046         private var _strTransitionType:String = "fade";                                 //type of transition
00047         private var _bFitAtStart:Boolean = false;       //should the gallery choose an appropriate media size based on window size
00048         private var _iSlideshowMetadataHeight:Number = 35;                              //the height of the textfield used to display media metadata
00049         private var _iMetadataViewWidth:Number = .25;                                   //the width of the metadata view when gallery when xml metaDataOptions is 'leftSide'
00050         private var _iThumbMaxHeight:Number;                                                    //dimesions of thumbnails
00051         private var _iThumbMaxWidth:Number;
00052         private var _iThumbTopMargin:Number = 15;                                               //style of thumbnail box
00053         private var _iThumbBorderWidth:Number;
00054         private var _iThumbScrollHeight:Number = 21;                                    //thumbnail scrollbar options
00055         private var _iThumbScrollWidth:Number = 25;             
00056         private var _iGalleryInfoHeight:Number;                                                 //dimesions of 'About' box
00057         private var _iGalleryInfoWidth:Number;  
00058         private var _bSmartLoad:Boolean = true;                                                 //should the gallery sequentailly preload images
00059         public var bShowHeaderBar:Boolean = true;                                               //should the gallery display the header bar
00060         public var bShowMenuBar:Boolean = true;                                                 //should the gallery display the menu bar
00061         private var _xmlMediaPosition:XMLNode;                                                  //where should media metadata be displayed
00062         private var _strExtensionModuleSrc:String = "";                                 //what .swf should the ExtensionModule display
00063         public var bLivePreviewMode:Boolean = true;                                     //indicates whether gallery is in live preview mode or not
00064         
00065         //page UI controls
00066         private var BackgroundColor:MovieClip;                                                  //movie clips and text fields that makeup visible elements
00067         private var BackgroundImg:MovieClip;
00068         private var HeaderBar:MovieClip;        
00069         private var PageTitle:MovieClip;
00070         private var GroupTitle:MovieClip;
00071         private var ContactInfo:MovieClip;
00072         private var GalleryMenuBar:MovieClip;
00073         private var DebugWindow:MovieClip;                              
00074         private var ThumbnailView:MovieClip;
00075         private var SlideShow:MovieClip;
00076         private var GalleryInfo:MovieClip;
00077         private var MetadataView:MovieClip;
00078         private var ToolTip:MovieClip;
00079         private var ExtensionModule:MovieClip;                                                  //used for loading a pre-compiled swf
00080         private var _strContactInfo:String;                                                             //link on the left side of the menu bar
00081         private var _strContactInfoLink:String;                                                 //url for the contact info link
00082         
00083         //UI Control vars
00084         public var iScreenWidth:Number;                                                                 //dimensions of the gallery
00085         public var iScreenHeight:Number;
00086         private var _iThumbnailControlWidthRatio:Number = .465;                 //the percentage of screen width for thumb control 
00087         private var _iControlsHeightRatio = .986;                                               //the ratio of max width to height for thumb control and slideshow control
00088         public var iSlideShowControlHeight:Number;                                              //height if slidehshow control area
00089         private var _iControlsTopSpacer:Number = 6;                                             //space between top bar and thumb/slideshow controls
00090         private var _iControlsSideSpacer:Number = 6;                                    //space between movie edge and thumb/slideshow controls
00091         private var _iControlsDividingSpacer = 6;                                               //space between thumb control and slideshow control
00092         private var _iPageTitle_x = 10;                                                                 //starting x pos of page title
00093         private var _iPageTitle_y = 10;                                                                 //starting y pos of page title
00094         private var _iGroupTitleMargin = 10;                                                    //distance from right side that group title starts
00095         private var _iGroupTitle_y = 10;                                                                //starting y pos of group title
00096         private var _iControlsDepth = 10;                                                               //the starting depth for all UI movieclips
00097         private var _iDebugWindowDepth:Number = 3000;                                   //the depth of the debug window
00098         private var _bHeaderUsesGraphic:Boolean = false;                                //does the header show text or an image
00099         private var _iHeaderBarHeight = 46;                                                             //height of header bar
00100 
00101         
00102         //menu params
00103         private var _aMenus:Array;                                                                              //array holding all menus
00104         private var _bMenuOpen:Boolean = false;                                                 //is a menu open
00105         public var _iMenuBarBgColor:Number = 0xff0000;                                  //menu styles
00106         public var _strMenuBarBgColor:String = "ff0000";
00107         public var _iMenuBarHoverColor:Number = 0xff0000;
00108         public var _iMenuBarTextColor:Number = 0xff0000;
00109         
00110         //listener objects
00111         private var _oStageListener:Object;                                                             //listener to detect changes in stage size
00112         private var _oKeyListener:Object;                                                               //listener to detect keyboard events
00113         private var _oFocusListener:Object;                                                             //listener to detect text focus events
00114         private var _oMouseListener:Object;                                                             //listener to detect mouse events -used to close menus
00115         
00116         //xml objects
00117         private var _xmlLocalText:XML;                                                                  //xml object to parse localizable text
00118         private var strLocalizationXmlUrl:String;       
00119         private var _xmlGroup:XML;                                                                              //xml object to parse media group info
00120         private var strGroupXmlUrl:String;
00121         private var _xmlStyle:XML;                                                                              //xml object to parse gallery style info
00122         private var strStyleXmlUrl:String;
00123         private var _xmlFlashVarsForProjector:XML;                                              //xml object to parse init values when flashvars are not present
00124         private var _lastPageTitleStyleNode;            
00125                         
00126         /****************************************************
00127         ** Gallery Class Constructor
00128         *****************************************************/
00129         public function Gallery() {
00130                 //set stage listener to resize the show elements when stage is resized
00131                 _oStageListener = new Object();
00132                 _oStageListener._parent = this;
00133                 Stage.scaleMode = "noScale";
00134                 Stage.align = "TL";
00135                 Stage.addListener(_oStageListener);
00136                 _oStageListener.onResize = resizeStage;
00137                 
00138                 //add a keyboard listener for keyboard control of gallery
00139                 _oKeyListener = new Object();
00140                 _oKeyListener._parent = this;
00141                 _oKeyListener.onKeyDown = keyboardHandler;
00142                 Key.addListener(_oKeyListener);
00143 
00144                 //check flash vars for base resources directory 
00145                 if(_root.baseRefUrl){
00146                         this._strBaseRefUrl = _root.baseRefUrl;
00147                 }
00148                 
00149                 //check URL for startSlide
00150                 if((_root.startImg != undefined)&&(_root.startImg != -1)){
00151                         this._iStartSlide = parseInt(_root.startImg)-1;
00152                 }
00153                 
00154                 //add a mouse listener for menu click states
00155                 _oMouseListener = new Object();
00156                 _oMouseListener._parent = this;
00157                 _oMouseListener.onMouseDown = mouseHandler;
00158                 Mouse.addListener(_oMouseListener);
00159                 
00160                 //init XML objects for data loading
00161                 _xmlGroup = new XML();
00162                 _xmlGroup.ignoreWhite = true;
00163                 _xmlLocalText = new XML();
00164                 _xmlLocalText.ignoreWhite = true;
00165                 _xmlStyle = new XML();
00166                 _xmlStyle.ignoreWhite = true;
00167                 _xmlFlashVarsForProjector = new XML();
00168                 _xmlFlashVarsForProjector.ignoreWhite = true;
00169                 
00170                 //start data loading process
00171                 if(!_root.stylexml)
00172                         this.loadFlashVarsForProjector();
00173                 else
00174                         this.loadLocalText();
00175 
00176         }
00177         
00178         /************************************************************************
00179         ** loadFlashVarsForProjector
00180         **Allows init values to be held in a file if flashvars are not available
00181         *************************************************************************/
00182         private function loadFlashVarsForProjector():Void {
00183                 var me:Object = this;
00184                 this._xmlFlashVarsForProjector.onLoad = function(success:Boolean) {
00185                         if (success) {
00186                                 me.parseFlashVarsForProjector();
00187                         } else {
00188                                 me.loadLocalText();
00189                         }
00190                 }
00191                 this._xmlFlashVarsForProjector.load("flashvars.xml");
00192         }
00193         
00194         /************************************************************************
00195         ** parseFlashVarsForProjector
00196         ** Allows init values to be held in a file if flashvars are not available
00197         *************************************************************************/
00198         function parseFlashVarsForProjector():Void{
00199                 _root.baseRefUrl = XPathAPI.selectSingleNode(_xmlFlashVarsForProjector.firstChild,"/FlashVars/baseRefUrl").firstChild.nodeValue;
00200                 _root.groupxml = XPathAPI.selectSingleNode(_xmlFlashVarsForProjector.firstChild,"/FlashVars/groupxml").firstChild.nodeValue;
00201                 _root.stylexml = XPathAPI.selectSingleNode(_xmlFlashVarsForProjector.firstChild,"/FlashVars/stylexml").firstChild.nodeValue;
00202                 _root.localText = XPathAPI.selectSingleNode(_xmlFlashVarsForProjector.firstChild,"/FlashVars/localText").firstChild.nodeValue;
00203                 
00204                 this.loadLocalText();
00205         }
00206         
00207         /************************************************************************
00208         ** loadLocalText
00209         **
00210         *************************************************************************/
00211         private function loadLocalText():Void {
00212                 
00213                 //check for passed in values from flashvars
00214                 if(_level0.localText){
00215                         this.strLocalizationXmlUrl = this._strBaseRefUrl + _level0.localText;
00216                 }
00217                 else{
00218                         //no flash vars, assume Flash IDE testing
00219                         this.strLocalizationXmlUrl = this._strBaseRefUrl + "localization/localText.xml";
00220                 }
00221                 
00222                 
00223                 //set the callback for xml load event that references this class as 'me'
00224                 var me:Object = this;
00225                 this._xmlLocalText.onLoad = function(success:Boolean) {
00226                         if (success) {
00227                                 me.parseLocalText();
00228                         } else {
00229                                 //error loading XML file: disregard style attempt
00230                                 //writeDebug("XML ERROR style","main");
00231                                 me.loadStyleXml();
00232                         }
00233                 }
00234                 //load the XML file
00235                 this._xmlLocalText.load(this.strLocalizationXmlUrl);
00236         }
00237         
00238         function parseLocalText():Void{
00239                 //perform menu data error checking
00240                 this.loadStyleXml();
00241         }
00242         
00243         /************************************************************************
00244         ** loadStyleXml
00245         ** This function loads the XML style description file 
00246         ** The onLoad callback function allows the show to wait
00247         ** until the XML has completely loaded before applying the styles
00248         ** the callback does not have scope to this class however
00249         ** hence the local 'me' variable used to provide scope back to this class
00250         *************************************************************************/
00251         private function loadStyleXml():Void {
00252                 
00253                 //check for passed in values from flashvars
00254                 if(_level0.stylexml){
00255                                 strStyleXmlUrl = this._strBaseRefUrl + _level0.stylexml;
00256                 }
00257                 else{
00258                                 //no flash vars, assume Flash IDE testing
00259                                 strStyleXmlUrl = this._strBaseRefUrl + "styles/testStyle.xml";
00260                         
00261                 }
00262                 
00263                 //set the callback for xml load event that references this class as 'me'
00264                 var me:Object = this;
00265                 this._xmlStyle.onLoad = function(success:Boolean) {
00266                         if (success) {
00267                                 me.parseStyle();
00268                         } else {
00269                                 //error loading XML file: disregard style attempt
00270                                 //writeDebug("XML ERROR style","main");
00271                                 me.loadGroupXml();
00272                         }
00273                 };
00274                 //load the SMIL file
00275                 this._xmlStyle.load(strStyleXmlUrl);
00276         }
00277         
00278         /************************************************************************
00279         ** parseStyle
00280         ** Parses the style xml document, setting the color and alpha of UI elements
00281         ** Note that the xml style nodes is also passed to both
00282         ** the SlideShow and ThumbnailView objects; this was done
00283         ** to insure that these objects could work on their own
00284         ** in some other context.
00285         *************************************************************************/
00286         function parseStyle():Void{
00287                                 
00288                 //set gallery option vals
00289                 this._strViewMode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/viewOptions").attributes.startingView;
00290                 this._strMetadataMode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/metadataOptions").attributes.metadataPosition;
00291                 this._strExtensionModuleSrc = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/extensionModule").attributes.src;
00292                 this._strCurrBandwidth = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/bandWidthOptions").attributes.connection;
00293                 this._strTransitionType = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/slideTransitions").attributes.transition;
00294                 this._xmlMediaPosition = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/mediaPosition");
00295                 this._iTransitionDuration = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/slideTransitions").attributes.transitionDuration;
00296                 this._iSlideDuration = parseFloat(XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/slideTransitions").attributes.slideDuration);
00297                 var strSlideshowMetadataAutoSize = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/slideshow/slideshowMetadata/metadataFieldText").attributes.autoSize;
00298                 if(strSlideshowMetadataAutoSize == "true"){
00299                         var iSlideshowMetadataFontSize = parseFloat(XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/slideshow/slideshowMetadata/metadataFieldText").attributes.size);
00300                         //set metadata height to fit two lines of given font size
00301                         this._iSlideshowMetadataHeight = iSlideshowMetadataFontSize * 3;
00302                 }
00303                 else
00304                         this._iSlideshowMetadataHeight = parseFloat(XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/slideshow/slideshowMetadata/metadataField").attributes.height);
00305                 
00306                 this._iMetadataViewWidth = parseFloat(XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/metadataView/metadataViewField").attributes.widthPercentage);
00307                 
00308                 this._iThumbBorderWidth =  parseFloat(XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/thumbnailView/thumbnails/thumbBorder").attributes.width);
00309                 if(XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/headerBar/headerBarEnabled").attributes.enabled == "true")
00310                         this.bShowHeaderBar = true;
00311                 else
00312                         this.bShowHeaderBar = false;
00313                 if(XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/menuBar/menuBarEnabled").attributes.enabled == "true")
00314                         this.bShowMenuBar = true;
00315                 else
00316                         this.bShowMenuBar = false;
00317                         
00318                 //set the starting image size
00319                 if(this._xmlMediaPosition.attributes.fitAtStart == "true")
00320                         this._bFitAtStart = true;
00321                 else {
00322                         this._bFitAtStart = false;
00323                 }
00324 
00325                 switch (this._strViewMode) {
00326                         case "galleryDefault" :
00327                                 this._strCurrView = "gallery";
00328                                 if(this._strCurrBandwidth == "broadband")
00329                                         this._currImageSize = "medium";
00330                                 else
00331                                         this._currImageSize = "small";
00332                                 this._strMetadataMode = "underPhotos";
00333                                 break;
00334                         case "slideshowDefault" :
00335                                 this._strCurrView = "slideshow";
00336                                 
00337                                 if(this._strCurrBandwidth == "broadband")
00338                                         this._currImageSize = "large";
00339                                 else
00340                                         this._currImageSize = "medium";
00341                                 this._strMetadataMode = "underPhotos";
00342                                 break;
00343                         case "slideshowOnly" :
00344                                 this._strCurrView = "slideshow";
00345                                 if(this._strCurrBandwidth == "broadband")
00346                                         this._currImageSize = "large";
00347                                 else
00348                                         this._currImageSize = "medium";
00349                                 break;
00350                         case "galleryScrollingLeft" :
00351                                 this._strMetadataMode = "underPhotos";
00352                         case "galleryScrollingBottom" :
00353                                 this._strCurrView = "gallery";
00354                                 this._currImageSize = "medium";
00355                                 break;
00356                         case "mapView" :
00357                                 this._strCurrView = "map";
00358                                 this._currImageSize = "large";
00359                                 this._strMetadataMode = "underPhotos";
00360                                 break;
00361                         case "extension" :
00362                                 this._strCurrView = "extension";
00363                                 this._currImageSize = "large";
00364                                 this._strMetadataMode = "underPhotos";
00365                                 break;
00366                         default :
00367                                 this._strViewMode = "galleryDefault";
00368                                 this._strCurrView = "gallery";
00369                                 if(this._strCurrBandwidth == "dialup")
00370                                         this._currImageSize = "small";
00371                                 else
00372                                         this._currImageSize = "medium";
00373                                 break;
00374                                 this._strMetadataMode = "underPhotos";
00375                 }
00376                 
00377                 
00378                 // ADD CONTROLS BLOCK         //
00379                 //adds UI controls to stage   //
00380                 
00381                 //debug window for testing purposes
00382                 this.DebugWindow = this.attachMovie("DebugWindow","debugWindow",_iDebugWindowDepth,{_visible:this._bDebugWindow});
00383                 this.DebugWindow.version.text = "Version: " + _strVersionNumber;
00384 
00385                 //background
00386                 this.BackgroundColor = this.attachMovie("BackgroundColor","backgroundColor",_iControlsDepth++,{_visible:false});
00387                 this.BackgroundImg = this.attachMovie("BackgroundImg","backgroundImg",_iControlsDepth++);
00388                 
00389                 //top bar
00390                 this.HeaderBar = this.attachMovie("HeaderBar","headerbar",_iControlsDepth++,{_visible:false});
00391                 
00392                 //page title
00393                 this.PageTitle = attachMovie("GalleryTitle","pageTitle",_iControlsDepth++,{_visible:false});
00394                 this.PageTitle._strFieldId = "PageTitle";
00395                 this.PageTitle.tabEnabled = false;
00396                 this.PageTitle.txtField.html = true;
00397                 this.PageTitle.txtField.multiline = false;
00398                 this.PageTitle.txtField.wordWrap = false;
00399                 this.PageTitle.txtField.selectable = false;
00400                 this.PageTitle.txtField.autoSize = true;
00401                 this.PageTitle.txtField.antiAliasType = "advanced";
00402                 //disable tool tips for titles 
00403                 //this.PageTitle.enableToolTips();
00404                 
00405                 //gallery title
00406                 this.GroupTitle = attachMovie("GalleryTitle","GroupTitle",_iControlsDepth++,{_visible:false});
00407                 this.GroupTitle._strFieldId = "GalleryTitle";
00408                 this.GroupTitle.tabEnabled = false;
00409                 this.GroupTitle.txtField.html = true;
00410                 this.GroupTitle.txtField.multiline = false;
00411                 this.GroupTitle.txtField.wordWrap = false;
00412                 this.GroupTitle.txtField.selectable = false;
00413                 this.GroupTitle.txtField.autoSize = true;
00414                 this.GroupTitle.txtField.antiAliasType = "advanced";
00415                 //disable tool tips for titles 
00416                 //this.GroupTitle.enableToolTips();
00417                 
00418                 //thumbnails control
00419         
00420                 if(this._strViewMode != "slideshowOnly"){
00421                         this.ThumbnailView = this.attachMovie("ThumbnailView","thumbnailView",_iControlsDepth++,{_visible:false});
00422                         this.ThumbnailView.initView(this._strViewMode,this._strBaseRefUrl,this._iThumbsTabIndex);
00423                 }
00424 
00425                 //SlideShow control
00426                 this.SlideShow = this.attachMovie("SlideShow","SlideShow",_iControlsDepth++,{_visible:false});
00427                 this.SlideShow.init(_strTransitionType,_iTransitionDuration,_iSlideDuration,_strPlayMode,this._strCurrView,this._strViewMode,this._iSlideshowMetadataHeight,this._xmlMediaPosition,this._strBaseRefUrl,this._bFitAtStart,_iSlideshowControlTabIndex);
00428                 
00429                 //Set Pregress Bar strings
00430                 var iloading:String = XPathAPI.selectSingleNode(_xmlLocalText.firstChild,"/localization/progressBars/loadingImgTxt").attributes.label;
00431                 var sloading:String = XPathAPI.selectSingleNode(_xmlLocalText.firstChild,"/localization/progressBars/loadingSizeTxt").attributes.label;
00432                 
00433                 if(iloading && sloading){
00434                         this.SlideShow.strImageLoading = iloading;
00435                         this.SlideShow.strSizeLoading = sloading;
00436                 }
00437                         
00438                 
00439                 //Set Tooltips
00440                 var xmlTooltips:Array = XPathAPI.selectNodeList(_xmlLocalText.firstChild,"/localization/toolTips/toolTip");
00441                 for(var i:Number = 0;i<xmlTooltips.length;i++){
00442                         if(xmlTooltips[i].attributes.item == "SlideshowVCRNextTip")
00443                                 this.SlideShow.SlideshowVCRNextTip = xmlTooltips[i].attributes.label;
00444                         else if(xmlTooltips[i].attributes.item == "SlideshowVCRPrevTip")
00445                                 this.SlideShow.SlideshowVCRPrevTip = xmlTooltips[i].attributes.label;
00446                         else if(xmlTooltips[i].attributes.item == "SlideshowVCRPauseTip")
00447                                 this.SlideShow.SlideshowVCRPauseTip = xmlTooltips[i].attributes.label;
00448                         else if(xmlTooltips[i].attributes.item == "SlideshowVCRPlayTip")
00449                                 this.SlideShow.SlideshowVCRPlayTip = xmlTooltips[i].attributes.label;
00450                         else if(xmlTooltips[i].attributes.item == "ThumbnailNextPageTip")
00451                                 this.ThumbnailView.ThumbnailNextPageTip = xmlTooltips[i].attributes.label;
00452                         else if(xmlTooltips[i].attributes.item == "ThumbnailPrevPageTip")
00453                                 this.ThumbnailView.ThumbnailPrevPageTip = xmlTooltips[i].attributes.label;
00454                         else if(xmlTooltips[i].attributes.item == "ThumbnailLastPageTip")
00455                                 this.ThumbnailView.ThumbnailLastPageTip = xmlTooltips[i].attributes.label;
00456                         else if(xmlTooltips[i].attributes.item == "ThumbnailFirstPageTip")
00457                                 this.ThumbnailView.ThumbnailFirstPageTip = xmlTooltips[i].attributes.label;
00458                         else if(xmlTooltips[i].attributes.item == "SlideshowViewGalleryTip")
00459                                 this.SlideShow.SlideshowViewGalleryTip = xmlTooltips[i].attributes.label;
00460                         else if(xmlTooltips[i].attributes.item == "SlideshowViewSlideshowTip")
00461                                 this.SlideShow.SlideshowViewSlideshowTip = xmlTooltips[i].attributes.label;
00462                         else if(xmlTooltips[i].attributes.item == "SlideshowViewGalleryTip")
00463                                 this.SlideShow.SlideshowViewGalleryTip = xmlTooltips[i].attributes.label;
00464                         else if(xmlTooltips[i].attributes.item == "SlideshowVideoPlayTip")
00465                                 this.SlideShow.SlideshowVideoPlayTip = xmlTooltips[i].attributes.label;
00466                         else if(xmlTooltips[i].attributes.item == "SlideshowVideoPauseTip")
00467                                 this.SlideShow.SlideshowVideoPauseTip = xmlTooltips[i].attributes.label;
00468                         else if(xmlTooltips[i].attributes.item == "SlideshowVideoRewindTip")
00469                                 this.SlideShow.SlideshowVideoRewindTip = xmlTooltips[i].attributes.label;
00470                 }
00471                 
00472                 //extended metadata box
00473                 this.MetadataView = this.attachMovie("MetadataView","metadatView",_iControlsDepth++,{_visible:false});
00474                 
00475                 //gallery info
00476                 this.GalleryInfo = this.attachMovie("GalleryInfo","galleryInfo",_iControlsDepth++,{_visible:false});
00477                 
00478                 //menu bar
00479                 this.GalleryMenuBar = this.attachMovie("GalleryMenuBar","galleryMenuBar",_iControlsDepth++,{_visible:false,_y:this.HeaderBar._height});
00480                 
00481                 //ContactInfo
00482                 this.ContactInfo = attachMovie("GalleryTitle","contactInfo",_iControlsDepth++,{_visible:false});
00483                 this.ContactInfo._strFieldId = "ContactInfo";
00484                 this.ContactInfo.tabEnabled = false;
00485                 this.ContactInfo.txtField.html = true;
00486                 this.ContactInfo.txtField.multiline = false;
00487                 this.ContactInfo.txtField.wordWrap = false;
00488                 this.ContactInfo.txtField.selectable = false;
00489                 this.ContactInfo.txtField.autoSize = true;
00490                 this.ContactInfo.txtField.antiAliasType = "advanced";
00491                 
00492                 //Map View
00493                 if((this._strExtensionModuleSrc != "")&&(this._strExtensionModuleSrc != null)){
00494                         this.ExtensionModule = attachMovie("ExtensionModule","extensionModule",_iControlsDepth++,{_visible:false});
00495                         this.ExtensionModule.loadModule(this._strExtensionModuleSrc,_strBaseRefUrl);
00496                 }
00497                 
00498                 //call a stage resize to position controls
00499                 if(embedEnabled){
00500                         setHeightWidth(_parent.podHeight,_parent.podWidth);
00501                 }
00502                 
00503                 this.buildMenus();
00504                 
00505                 //add tool tip
00506                 this.ToolTip = this.attachMovie("ToolTip","toolTip",_iControlsDepth++,{_visible:false});
00507                 
00508                 this.applyStyles();
00509         }
00510         
00511         /************************************************************************
00512         ** applyStyles
00513         ** changes UI movieclips based on style values
00514         *************************************************************************/
00515         private function applyStyles():Void{
00516 
00517                 //send other objects their style nodes
00518                 this.SlideShow.parseStyleXML(XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/slideshow"));
00519                 this.SlideShow.setCurrImgSize(this._currImageSize);
00520                 this.ThumbnailView.parseStyleXML(XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/thumbnailView"));
00521                 this.MetadataView.parseStyleXML(XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/metadataView"));
00522 
00523                 //Background
00524                 var xmlBackgroundColor:XMLNode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/background/backgroundBgColor");
00525                 this.setTint(BackgroundColor,xmlBackgroundColor.attributes.color,xmlBackgroundColor.attributes.alpha);
00526                 var xmlBackgroundImg:XMLNode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/background/backgroundBgImg");
00527                 //set background image
00528                 if(xmlBackgroundImg.attributes.src != ""){
00529                         //use a MovieClipLoader to load the background jpeg of swf
00530                         var bgLoader:MovieClipLoader = new MovieClipLoader();
00531                         //use this class as the callback
00532                         bgLoader.addListener(this);
00533                         bgLoader.loadClip(this._strBaseRefUrl+xmlBackgroundImg.attributes.src,BackgroundImg.bgImgContainer);
00534                         BackgroundImg._alpha = xmlBackgroundImg.attributes.alpha;
00535                 
00536                 }
00537                 
00538                 //Top Bar       
00539                 var xmlHeaderBarColor:XMLNode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/headerBar/headerBarColor");
00540                 this.setTint(HeaderBar.mcTopColorBar,xmlHeaderBarColor.attributes.color,xmlHeaderBarColor.attributes.alpha);
00541                 
00542                 //Page Title
00543                 var xmlPageTitle:XMLNode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/headerBar/pageTitle");
00544                 this._lastPageTitleStyleNode = xmlPageTitle;
00545                 var xmlPageTitleImg:XMLNode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/headerBar/pageTitleImg");
00546                 if((xmlPageTitleImg != null)&&(xmlPageTitleImg.attributes.src != "")&&(xmlPageTitleImg.attributes.visible == "true")){
00547                                 this.PageTitle = this.createEmptyMovieClip("pageTitle",this.PageTitle.getDepth());
00548                                 this.PageTitle.createEmptyMovieClip("headerImage",1);
00549                                 
00550                                 var mclListener:Object = new Object();
00551                                 mclListener._parent = this;
00552                                 mclListener.onLoadInit = function(target_mc:MovieClip) {
00553                                         if(target_mc._height > this._parent._iHeaderBarHeight){
00554                                                 var scalar:Number = (this._parent._iHeaderBarHeight/target_mc._height)*100;
00555                                                 target_mc._yscale = scalar;
00556                                                 target_mc._xscale = scalar;
00557                                         }
00558                                         if(this._parent.embedEnabled)
00559                                                 this._parent.setHeightWidth(this._parent._parent.podHeight,this._parent._parent.podWidth);
00560                                         else 
00561                                                 this._parent._oStageListener.onResize();
00562                                 };
00563 
00564                                 var imgLoader:MovieClipLoader = new MovieClipLoader();
00565                                 //use this class as the callback
00566                                 imgLoader.addListener(mclListener);
00567                                 imgLoader.loadClip(this._strBaseRefUrl+xmlPageTitleImg.attributes.src,this.PageTitle.headerImage);
00568                                 this._bHeaderUsesGraphic = true;
00569                                 
00570                 }
00571                 else {
00572                         this._bHeaderUsesGraphic = false;
00573                         this.PageTitle.txtField._alpha = xmlPageTitle.attributes.alpha;
00574                         var txtFont:String = xmlPageTitle.attributes.fontFamily;
00575                         var txtColor:String = "#"+xmlPageTitle.attributes.color;
00576                         var txtSize:String = xmlPageTitle.attributes.size;
00577                         
00578                         if(txtFont == "Myriad Web Pro")
00579                                 this.PageTitle.txtField.embedFonts = true;
00580                         else
00581                                 this.PageTitle.txtField.embedFonts = false;
00582                         var styles:TextField.StyleSheet = new TextField.StyleSheet();
00583                         styles.setStyle("textStyle", {
00584                                 color:txtColor,
00585                                 fontFamily:txtFont,
00586                                 fontSize:txtSize, 
00587                                 textAlign:"left"
00588                         });
00589                         styles.setStyle("a:link", {
00590                                 color:txtColor
00591                         });
00592                         styles.setStyle("a:hover", {
00593                                 textDecoration:'underline'
00594                         });
00595                         this.PageTitle.txtField.styleSheet = styles;
00596                 }
00597 
00598                 //Group Name
00599                 var xmlGroupTitle:XMLNode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/headerBar/groupTitle");
00600                 this.GroupTitle.txtField._alpha = xmlGroupTitle.attributes.alpha;
00601                 var txtFont:String = xmlGroupTitle.attributes.fontFamily;
00602                 var txtColor:String = "#"+xmlGroupTitle.attributes.color;
00603                 var txtSize:String = xmlGroupTitle.attributes.size;
00604                 
00605                 if(txtFont == "Myriad Web Pro")
00606                         this.GroupTitle.txtField.embedFonts = true;
00607                 else
00608                         this.GroupTitle.txtField.embedFonts = false;
00609                 
00610                 var styles:TextField.StyleSheet = new TextField.StyleSheet();
00611                 styles.setStyle("textStyle", {
00612                         color:txtColor,
00613                         fontFamily:txtFont,
00614                         fontSize:txtSize, 
00615                         textAlign:"right"
00616                 });
00617                 styles.setStyle("a:link", {
00618                         color:txtColor
00619                 });
00620                 styles.setStyle("a:hover", {
00621                         textDecoration:'underline'
00622                 });
00623                 
00624                 this.GroupTitle.txtField.styleSheet = styles;
00625 
00626                 //Contact Info
00627                 var xmlContactInfoText:XMLNode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/contactInfo/contactInfoText");
00628                 this.ContactInfo.txtField._alpha = xmlContactInfoText.attributes.alpha;
00629                 var txtFont:String = xmlContactInfoText.attributes.fontFamily;
00630                 var txtColor:String = "#"+xmlContactInfoText.attributes.color;
00631                 var txtSize:String = xmlContactInfoText.attributes.size;
00632                 var txtAlign:String = xmlContactInfoText.attributes.align ;
00633                 
00634                 if(txtFont == "Myriad Web Pro")
00635                         this.ContactInfo.txtField.embedFonts = true;
00636                 else
00637                         this.ContactInfo.txtField.embedFonts = false;
00638                 
00639                 var styles:TextField.StyleSheet = new TextField.StyleSheet();
00640                 styles.setStyle("textStyle", {
00641                         color:txtColor,
00642                         fontFamily:txtFont,
00643                         fontSize:txtSize, 
00644                         textAlign:"right"
00645                 });
00646                 styles.setStyle("a:link", {
00647                         color:txtColor
00648                 });
00649                 styles.setStyle("a:hover", {
00650                         textDecoration:'underline'
00651                 });
00652                 
00653                 this.ContactInfo.txtField.styleSheet = styles;
00654                 
00655                 //MenuBar Background
00656                 var xmlMenuBgColor:XMLNode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/menuBar/menuBgColor");
00657                 var xmlMenuHover:XMLNode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/menuBar/menuHover");
00658                 var xmlMenuBorder:XMLNode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/menuBar/menuBorder");
00659                 var xmlMenuText:XMLNode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/menuBar/menuText");
00660                 this.setTint(GalleryMenuBar.menuBarBg,xmlMenuBgColor.attributes.color,xmlMenuBgColor.attributes.alpha);
00661                 
00662                 //menu colors
00663                 for(var i:Number=0;i<this._aMenus.length;i++){
00664                         this._aMenus[i].setHeaderBgColor(xmlMenuBgColor.attributes.color,xmlMenuBgColor.attributes.alpha);
00665                         this._aMenus[i].setHeaderTextColor(xmlMenuText.attributes.color,xmlMenuText.attributes.alpha);
00666                         this._aMenus[i].setHeaderHoverColor(xmlMenuHover.attributes.color,xmlMenuHover.attributes.alpha);
00667                         this._aMenus[i].setItemsTextColor(xmlMenuText.attributes.color,xmlMenuText.attributes.alpha);
00668                         this._aMenus[i].setItemsBgColor(xmlMenuBgColor.attributes.color,xmlMenuBgColor.attributes.alpha);
00669                         this._aMenus[i].setItemsHoverColor(xmlMenuHover.attributes.color,xmlMenuHover.attributes.alpha);
00670                         this._aMenus[i].setItemsBorderColor(xmlMenuBorder.attributes.color,xmlMenuBorder.attributes.alpha);
00671                 }
00672                 
00673                 
00674                 //Gallery Info
00675                 var xmlGalleryInfo:XMLNode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/galleryInfo");
00676                 var xmlGalleryTextField:XMLNode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/galleryInfo/galleryInfoTextField");
00677                 this._iGalleryInfoHeight = parseFloat(xmlGalleryTextField.attributes.height);
00678                 this._iGalleryInfoWidth = parseFloat(xmlGalleryTextField.attributes.width);
00679                 
00680                 this.GalleryInfo.parseStyleXML(xmlGalleryInfo);
00681                 
00682                 /*
00683                 var xmlDebugOptions:XMLNode = XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/debugOptions");
00684                 if(xmlDebugOptions.attributes.debugWindow == "true"){
00685                         this._bDebugWindow = true;
00686                         this.toggleDebug();
00687                 }
00688                 */
00689                 
00690                 //load the photo group
00691                 this.loadGroupXml();
00692                 
00693         }
00694         
00695         //if loading a bg image, scale it when loaded
00696         public function onLoadInit(){
00697                 this.BackgroundImg._width = this.iScreenWidth;
00698                 this.BackgroundImg._height = this.iScreenHeight;                
00699         }
00700         
00701         //get rid of all menus if updating menus vlues in real-time
00702         public function clearMenus(){
00703                 for(var i:Number=0;i<this._aMenus.length;i++){
00704                         this._aMenus[i].removeMovieClip();
00705                 }
00706         }
00707         
00708         //build the menu objects and the arrays that hold them
00709         public function buildMenus():Void{
00710                 this._aMenus = new Array();
00711                 var xmlMenus:XMLNode = XPathAPI.selectSingleNode(_xmlLocalText.firstChild,"/localization/galleryMenus");
00712                 //loop through the menu xml
00713                 var menuHeader:XMLNode =  xmlMenus.firstChild;
00714                 var menuItem:XMLNode;
00715                 var menuPos:Number = 10;
00716                 var abortFlag:Boolean = false;
00717                 while(menuHeader){
00718                         var menuHeaderEvent:String = menuHeader.attributes.event;
00719                         
00720                         switch (menuHeaderEvent) {
00721                                 case "MenuView" :
00722                                         
00723                                         break;
00724                                 case "MenuConnection" :
00725                                         
00726                                         break;
00727                         }
00728                         if(!abortFlag){
00729                                 var newMenu:MovieClip = this.attachMovie("GalleryMenu","Menu"+this._aMenus.length,_iControlsDepth++,{_visible:false,_y:this.HeaderBar._height,_x:menuPos});
00730                                 var menuHeaderLabel:String = menuHeader.attributes.label;
00731                                 var menuHeaderEvent:String = menuHeader.attributes.event;
00732                                 //add the menu header
00733                                 newMenu.initMenu(menuHeaderLabel,menuHeaderEvent,_iMenuTabIndex++);
00734                                 //if menu header has children
00735                                 if(menuHeader.hasChildNodes()){
00736                                         
00737                                         //menu item found
00738                                         menuItem = menuHeader.firstChild;
00739                                         
00740                                         //loop through menu items
00741                                         while(menuItem){
00742                                                 //vals for label and event
00743                                                 var menuItemLabel:String = menuItem.attributes.label;
00744                                                 var menuItemEvent:String = menuItem.attributes.event;
00745                                                 var menuPrevNode:String = menuItem.attributes.prevNode;
00746                                                 //set menu type
00747                                                 var menuType:String = "regular";
00748                                                 if(menuItem.attributes.type)
00749                                                         menuType = menuItem.attributes.type;
00750                                                 
00751                                                 //test special menu cases based on gallery options
00752                                                 switch(menuHeaderEvent) {
00753                                                         case "MenuView" :
00754                                                                         //in slideshow only, don't show the "gallery" menu
00755                                                                         
00756                                                                         if(_strViewMode == "slideshowOnly"){
00757                                                                                 if(menuItemEvent != "MenuViewGallery")
00758                                                                                         newMenu.addMenuItem(menuItemLabel,menuType,false,menuItemEvent,_iMenuTabIndex++,menuPrevNode);
00759                                                                         }
00760                                                                         else if(_strViewMode == "mapView"){
00761                                                                                 if(menuItemEvent == "MenuViewMap")
00762                                                                                         newMenu.addMenuItem(menuItemLabel,menuType,true,menuItemEvent,_iMenuTabIndex++,menuPrevNode);
00763                                                                                 else
00764                                                                                         newMenu.addMenuItem(menuItemLabel,menuType,false,menuItemEvent,_iMenuTabIndex++,menuPrevNode);
00765         
00766                                                                         }
00767                                                                         //in default mode, show gallery and slideshow view options
00768                                                                         //and set the selected value based on the current view
00769                                                                         else {
00770                                                                                 if(_strCurrView == "gallery")
00771                                                                                         newMenu.addMenuItem(menuItemLabel,menuType,(menuItemEvent == "MenuViewGallery"),menuItemEvent,_iMenuTabIndex++,menuPrevNode);
00772                                                                                 else
00773                                                                                         newMenu.addMenuItem(menuItemLabel,menuType,(menuItemEvent == "MenuViewSlideshow"),menuItemEvent,_iMenuTabIndex++,menuPrevNode);
00774                                                                         }
00775                                                                 break;
00776                                                         case "MenuConnection" :
00777                                                                 if(this._strCurrBandwidth == "broadband")
00778                                                                         newMenu.addMenuItem(menuItemLabel,menuType,(menuItemEvent == "MenuConnectionBroadband"),menuItemEvent,_iMenuTabIndex++,menuPrevNode);
00779                                                                 else
00780                                                                         newMenu.addMenuItem(menuItemLabel,menuType,(menuItemEvent == "MenuConnectionBroadband"),menuItemEvent,_iMenuTabIndex++,menuPrevNode);
00781                                                                 
00782                                                                 break;
00783                                                         default:
00784                                                                 newMenu.addMenuItem(menuItemLabel,menuType,false,menuItemEvent,_iMenuTabIndex++,menuPrevNode);
00785                                                         
00786                                                 }
00787                                                 
00788                                                 
00789                                                 menuItem = menuItem.nextSibling;
00790                                         }
00791                                         
00792                                 }
00793                                 this._aMenus.push(newMenu);
00794                                 menuPos += newMenu.MenuHeader._width;
00795                                 
00796                         }
00797                         abortFlag = false;
00798                         menuHeader = menuHeader.nextSibling;
00799                 }
00800         }
00801         
00802         
00803         /************************************************************************
00804         ** loadGroupXml
00805         ** This function loads the XML media group file 
00806         ** The onLoad callback function allows the show to wait
00807         ** until the XML has completely loaded before starting the slideshow
00808         ** the callback does not have scope to this class however
00809         ** hence the local 'me' variable used to provide scope back to this class
00810         *************************************************************************/
00811         private function loadGroupXml(xmlUrl:String):Void {
00812                 
00813                 if(xmlUrl){
00814                         strGroupXmlUrl = this._strBaseRefUrl + xmlUrl;
00815                 }
00816                 else{
00817                         //no passed xml url, get value from flashvar
00818                         if(_level0.groupxml){
00819                                 strGroupXmlUrl = this._strBaseRefUrl + _level0.groupxml;
00820                         }
00821                         else {
00822                                 //no flash vars, assume internal Flash testing with sample data
00823                                 strGroupXmlUrl = "groups/landscapes.xml",this;
00824                                 
00825                         }
00826                 }
00827 
00828                 //set the callback for xml load event that references this class as 'me'
00829                 var me:Object = this;
00830                 this._xmlGroup.onLoad = function(success:Boolean) {
00831                         
00832                         if (success) {
00833                                 me.startShow();
00834                         } else {
00835                                 //error loading XML file
00836                                 //writeDebug("XML ERROR group","main");
00837                         }
00838 
00839                         // arahn [ 10/18/2006 ] Notify lightroom that we're ready for callbacks to begin coming in
00840                         ExternalInterface.call( 'movieLoaded' )
00841                 };
00842                 //load the XML file
00843                 
00844                 this._xmlGroup.load(strGroupXmlUrl);
00845                                 
00846         }
00847         
00848         /*********************************************************
00849         ** parseGroupXML
00850         ** Parses the media group XML file
00851         ** Note that the xml list of media is also passed to both
00852         ** the SlideShow and ThumbnailView objects; this was done
00853         ** to insure that these objects could work on their own
00854         ** in some other context.
00855         **********************************************************/
00856         private function parseGroupXML():Void {
00857                 //set applicastion values based on groupXML values
00858                 this._strPageTitle = XPathAPI.selectSingleNode(_xmlGroup.firstChild,"/mediaGroup/groupInfo/custom/siteTitle").firstChild;
00859                 if(this._strPageTitle == null)
00860                         this._strPageTitle = "";
00861                 this._strGroupTitle = XPathAPI.selectSingleNode(_xmlGroup.firstChild,"/mediaGroup/groupInfo/custom/groupTitle").firstChild;
00862                 if(this._strGroupTitle == null)
00863                         this._strGroupTitle = "";
00864                 this._strContactInfo = XPathAPI.selectSingleNode(_xmlGroup.firstChild,"/mediaGroup/groupInfo/custom/contactName").firstChild;
00865                 if(this._strContactInfo == null)
00866                         this._strContactInfo = "";
00867                 this._strContactInfoLink = XPathAPI.selectSingleNode(_xmlGroup.firstChild,"/mediaGroup/groupInfo/custom/contactEmail").firstChild.toString();
00868                 if((this._strContactInfoLink.indexOf("http:") == -1) && (this._strContactInfoLink.indexOf("mailto:") == -1)){
00869                         this._strContactInfoLink = "mailto:"+this._strContactInfoLink;
00870                 }
00871                 this._strGroupDesc = XPathAPI.selectSingleNode(_xmlGroup.firstChild,"/mediaGroup/groupInfo/custom/groupDescription");
00872                 this.strGroupID = XPathAPI.selectSingleNode(_xmlGroup.firstChild,"/mediaGroup/groupInfo/groupData").attributes.groupId;
00873                 this.GalleryInfo.setText(this._strGroupDesc);
00874                 
00875                 //find thumbnail max height
00876                 var mediaSizes:Array =  XPathAPI.selectNodeList(_xmlGroup.firstChild,"/mediaGroup/sizes/imageSize");
00877                 for(var i:Number=0;i<mediaSizes.length;i++){
00878                         if(mediaSizes[i].attributes.size == "thumb"){
00879                                 this._iThumbMaxHeight = parseFloat(mediaSizes[i].attributes.maxheight);
00880                                 this._iThumbMaxWidth = parseFloat(mediaSizes[i].attributes.maxwidth);
00881                                 break;
00882                         }
00883                 }
00884                                                                                         
00885                 //pass the mediagroup to the slideshow and thumbnail view controls
00886                 this.SlideShow.parseMediaGroup(_xmlGroup.firstChild);
00887                 this.ThumbnailView.parseMediaGroup(_xmlGroup.firstChild);
00888                 this.ExtensionModule.parseMediaGroup(_xmlGroup.firstChild);
00889                 this.MetadataView.parseMediaGroup(_xmlGroup.firstChild);
00890                 
00891                 _root.mcWaitBar.removeMovieClip();
00892                 if(embedEnabled){
00893                         setHeightWidth(_parent.podHeight,_parent.podWidth);
00894                 }
00895                 else {
00896                         _oStageListener.onResize();
00897                 }
00898                 
00899         }
00900         
00901         /**************DUMP OBJECTS - FOR DEBUG ONLY
00902         function dumpObjects() {
00903                 //  DUMP RESULTS
00904                 var i, j:Number;
00905                 for (i=0; i<_aThumbClips.length; i++) {
00906                         trace(_aThumbClips[i]);
00907                         trace("-----------------");
00908                 }
00909         }********************************************/
00910         
00911         
00912         /*************************************
00913         ** startShow
00914         ** used to load the media group when the UI
00915         ** is built and styled
00916         **************************************/
00917         private function startShow():Void {
00918                 //parse the SMIL description file; this builds the associated array of MediaClips: {clip:startTime}
00919                 this.parseGroupXML();
00920                 
00921                 //begin loading the ImageClips if fitAtStart has not done so already    
00922                 if(!_bFitAtStart)
00923                         this.SlideShow.startView(_iStartSlide,_bSmartLoad);
00924                 
00925         }
00926         
00927         /*************************************
00928         ** dispatchEvent
00929         ** main event dispatcher allowing communication between 
00930         ** gallery objects
00931         **************************************/
00932         public function dispatchEvent(eventName:String,eventValue:Object):Void{
00933                 switch (eventName) {
00934                         case "firstImageLoaded":
00935                                 ThumbnailView.smartLoader();
00936                                 break;
00937                         case "setMediaItem" : 
00938                                 ThumbnailView.setCurrentThumbNum(eventValue);
00939                                 MetadataView.selectItem(eventValue);
00940                                 break;
00941                         case "mediaAdvance" :
00942                                 break;
00943                         case "thumbClick" :
00944                                 SlideShow.slideshowControl(eventValue);
00945                                 break;
00946                         case "pageControl" :
00947                                 //_root.syncConnector.dispatchSyncMessage(eventName,eventValue);
00948                                 break;
00949                         case "keyBoardRight":
00950                                 SlideShow.slideshowControl("forward");
00951                                 break;
00952                         case "keyBoardLeft":
00953                                 SlideShow.slideshowControl("back");
00954                                 break;
00955                         case "keyBoardSpace":
00956                                 SlideShow.dispatchEvent("togglePause","pause");
00957                                 break;
00958                         case "suspendKeyboard":
00959                                 this.suspendKeyboard();
00960                                 break;
00961                         case "resumeKeyboard":
00962                                 this.resumeKeyboard();
00963                                 break;
00964                         case "menuOpen":
00965                                 this._bMenuOpen = true;
00966                                 break;
00967                         case "menuClose":
00968                                 this._bMenuOpen = false;
00969                                 break;
00970                         case "menuHeaderRollover":
00971                                 if(_bMenuOpen){
00972                                         for(var i:Number=0;i<_aMenus.length;i++){
00973                                                 this._aMenus[i].dispatchEvent("closeMenu");
00974                                         }
00975                                         eventValue.rollAsClick();
00976                                 }
00977                                 break;
00978                         case "menuItemClick":
00979                                 
00980                                 break;
00981                         case "showSlideshow" :
00982                                 for(var i:Number=0;i<this._aMenus.length;i++){
00983                                         if (this._aMenus[i].menuHeaderEvent == "MenuView")
00984                                                 this._aMenus[i].setSelectedItem("MenuViewSlideshow");
00985                                 }
00986                                 this.changeView("slideshow",this._strCurrBandwidth);
00987                                 break;
00988                         case "showThumbnails" :
00989                                 for(var i:Number=0;i<this._aMenus.length;i++){
00990                                         if (this._aMenus[i].menuHeaderEvent == "MenuView")
00991                                                 this._aMenus[i].setSelectedItem("MenuViewGallery");
00992                                 }
00993                                 this.changeView("gallery",this._strCurrBandwidth);
00994                                 break;
00995                         case "ThumbnailViewLeft":
00996                                 this.ThumbnailView.scrollThumbsLeft();
00997                                 break;
00998                         case "ThumbnailViewRight":
00999                                 this.ThumbnailView.scrollThumbsRight();
01000                                 break;
01001                         case "ThumbnailViewScrollUp":
01002                                 this.ThumbnailView.scrollThumbsUp();
01003                                 break;
01004                         case "ThumbnailViewScrollDown":
01005                                 this.ThumbnailView.scrollThumbsDown();
01006                                 break;
01007                         case "SlideshowScrollUp":
01008                                 this.SlideShow.scrollImageUp();
01009                                 break;
01010                         case "SlideshowScrollDown":
01011                                 this.SlideShow.scrollImageDown();
01012                                 break;
01013                         case "SlideshowLeft":
01014                                 this.SlideShow.scrollImageLeft();
01015                                 break;
01016                         case "SlideshowRight":
01017                                 this.SlideShow.scrollImageRight();
01018                                 break;
01019                         case "ThumbnailViewRight":
01020                                 this.ThumbnailView.scrollThumbsRight();
01021                                 break;
01022                         case "GalleryInfoScrollUp":
01023                                 this.GalleryInfo.ScrollingField.scrollTextUp();
01024                                 break;
01025                         case "GalleryInfoScrollDown":
01026                                 this.GalleryInfo.ScrollingField.scrollTextDown();
01027                                 break;
01028                         case "MetadataViewScrollUp":
01029                                 this.MetadataView.ScrollingField.scrollTextUp();
01030                                 break;
01031                         case "MetadataViewScrollDown":
01032                                 this.MetadataView.ScrollingField.scrollTextDown();
01033                                 break;
01034                         case "broadband" :
01035                                 this.changeView(this._strCurrView,"broadband");
01036                                 break;
01037                         case "dialup" :
01038                                 this.changeView(this._strCurrView,"dialup");
01039                                 break;
01040                         case "closeMenus":      
01041                                 for(var i:Number=0;i<_aMenus.length;i++)
01042                                         this._aMenus[i].dispatchEvent("closeMenu");
01043                                 break;
01044                         case "MenuViewGallery":
01045                                 this.changeView("gallery",this._strCurrBandwidth);
01046                                 break;
01047                         case "MenuViewSlideshow":
01048                                 this.changeView("slideshow",this._strCurrBandwidth);
01049                                 break;
01050                         case "MenuViewAbout":
01051                                 this.changeView("about",this._strCurrBandwidth);
01052                                 break;
01053                         case "MenuViewMap":
01054                                 this._strCurrView = "map";
01055                                 if(embedEnabled)
01056                                         setHeightWidth(_parent.podHeight,_parent.podWidth);
01057                                 else
01058                                         this._oStageListener.onResize();
01059                                 break;
01060                         case "MenuConnectionBroadband":
01061                                 this.changeView(this._strCurrView,"broadband");
01062                                 break;
01063                         case "MenuConnectionDialup":
01064                                 this.changeView(this._strCurrView,"dialup");
01065                                 break;
01066                         case "changeImageSize":
01067                                 this.changeImageSize(eventValue.toString());
01068                                 break;
01069                         case "MenuImageSizeSmall":
01070                                 if(this._currImageSize != "small")
01071                                         this.changeImageSize("small");
01072                                 break;
01073                         case "MenuImageSizeMedium":
01074                                 if(this._currImageSize != "medium")
01075                                         this.changeImageSize("medium");
01076                                 break;
01077                         case "MenuImageSizeLarge":
01078                                 if(this._currImageSize != "large")
01079                                         this.changeImageSize("large");
01080                                 break;
01081                         case "MenuImageSizeXLarge":
01082                                 if(this._currImageSize != "xlarge")
01083                                         this.changeImageSize("xlarge");
01084                                 break;
01085                         case "videoPlayCurrent":
01086                                 this.SlideShow.playCurrentVideo();
01087                                 break;
01088                         case "videoPauseCurrent":
01089                                 this.SlideShow.pauseCurrentVideo();
01090                                 break;
01091                         case "videoRewindCurrent":
01092                                 this.SlideShow.rewindCurrentVideo();
01093                                 break;
01094                         case "videoComplete":
01095                                 this.SlideShow.videoComplete();
01096                                 break;
01097                         case "mapItemClick":
01098                                 for(var i:Number=0;i<this._aMenus.length;i++){
01099                                         if (this._aMenus[i].menuHeaderEvent == "MenuView")
01100                                                 this._aMenus[i].setSelectedItem("MenuViewSlideshow");
01101                                 }
01102                                 SlideShow.slideshowControl(eventValue);
01103                                 this._strCurrView = "slideshow";
01104                                 if(embedEnabled)
01105                                         setHeightWidth(_parent.podHeight,_parent.podWidth);
01106                                 else
01107                                         this._oStageListener.onResize();
01108                                 break;
01109                         case "showMap":
01110                                 for(var i:Number=0;i<this._aMenus.length;i++){
01111                                         if (this._aMenus[i].menuHeaderEvent == "MenuView")
01112                                                 this._aMenus[i].setSelectedItem("MenuViewMap");
01113                                 }
01114                                 this._strCurrView = "map";
01115                                 if(embedEnabled)
01116                                         setHeightWidth(_parent.podHeight,_parent.podWidth);
01117                                 else
01118                                         this._oStageListener.onResize();
01119                                 break;
01120                         
01121                 }
01122                 
01123         }
01124         
01125         
01126         
01127         /************************************************************************
01128         ** loadGroupXMLChunk
01129         ** Function that allows authoring applications to send the media group xml
01130         ** file in sections, allowing users to see their gallery before
01131         ** the authoring app has completed creating the entire group file
01132         ***********************************************************************/
01133         public function loadGroupXMLChunk(p_xmlNode:XMLNode){
01134                 this.ThumbnailView.loadGroupXMLChunk(p_xmlNode.firstChild);
01135                 this.SlideShow.loadGroupXMLChunk(p_xmlNode.firstChild);
01136         }
01137         
01138         //removes keyboard listener when keyboard-enabled objects need it
01139         public function suspendKeyboard(){
01140                 Key.removeListener(_oKeyListener);
01141         }
01142         
01143         //adds the listener back
01144         public function resumeKeyboard(){
01145                 if(!this.embedEnabled)
01146                         Key.addListener(_oKeyListener);
01147         }
01148         
01149         /************************************************************************
01150         ** keyboardHandler
01151         ** This function is called from the Keyboard Listener Object
01152         ** which does not have direct scope into the Gallery class.
01153         ** The _parent prop is explicitly set in the listener obj's constructor
01154         ** so that _parent, in this case, refers to Gallery itself
01155         *************************************************************************/
01156         private function keyboardHandler():Void {
01157                 if (Key.getCode() == Key.RIGHT) {
01158                         _parent.dispatchEvent("keyBoardRight");
01159                 }
01160                 if (Key.getCode() == Key.LEFT) {
01161                         _parent.dispatchEvent("keyBoardLeft");
01162                 }
01163                 if (Key.getCode() == Key.UP) {
01164                         _parent.dispatchEvent("keyBoardLeft");
01165                 }
01166                 if (Key.getCode() == Key.DOWN) {
01167                         _parent.dispatchEvent("keyBoardRight");
01168                 }
01169                 if (Key.getCode() == Key.SPACE) {
01170                         _parent.dispatchEvent("keyBoardSpace");
01171                 }
01172         }
01173 
01174         //closes menus when clicks occur off of them
01175         private function mouseHandler() {
01176                 if(this._parent._bMenuOpen){
01177                         this._parent.dispatchEvent("closeMenus");
01178                         this._parent._bMenuOpen = false;
01179                 }
01180         }
01181         
01182         //changes the current size of media begin displayed
01183         private function changeImageSize(newImageSize:String){
01184                 
01185                 this._currImageSize = newImageSize;
01186                 this.SlideShow.changeCurrView(this._strCurrView,newImageSize);
01187                 if(_bFitAtStart){
01188                         for(var i:Number=0;i<this._aMenus.length;i++){
01189                                 if (this._aMenus[i].menuHeaderEvent == "MenuImageSize"){
01190                                         for(var j:Number=0;j<this._aMenus[i]._aMenuItems.length;j++){
01191                                                 var menuEvent:String = this._aMenus[i]._aMenuItems[j].menuEvent.toLowerCase();
01192                                                 if(menuEvent.indexOf(this._currImageSize) != -1)
01193                                                         this._aMenus[i].setSelectedItem(this._aMenus[i]._aMenuItems[j].menuEvent);
01194                                         }
01195                                 }
01196                                         
01197                         }
01198                 }
01199         }
01200 
01201         //changes the current gallery view
01202         private function changeView(newView:String,newBandwidth:String):Void {
01203                 this._strCurrView = newView;
01204                 this._strCurrBandwidth = newBandwidth;
01205                 
01206                 //this fitAtStart flag allows us to change image sizes without regard for bandwidth and veiw
01207                 if(!this._bFitAtStart){
01208                         if(newView != "about") {
01209                                 if(this._strCurrBandwidth == "broadband"){
01210                                         if (_strCurrView == "gallery"){
01211                                                 this._currImageSize = "medium";
01212                                                 this.SlideShow.changeCurrView(newView,"medium");
01213                                         }
01214                                         else if (_strCurrView == "slideshow"){
01215                                                 this._currImageSize = "large";
01216                                                 this.SlideShow.changeCurrView(newView,"large");
01217                                         }
01218                                 }
01219                                 else if(this._strCurrBandwidth == "dialup"){
01220                                         if (_strCurrView == "gallery"){
01221                                                 this._currImageSize = "small";
01222                                                 this.SlideShow.changeCurrView(newView,"small");
01223                                         }
01224                                         else if (_strCurrView == "slideshow"){
01225                                                 this._currImageSize = "medium";
01226                                                 this.SlideShow.changeCurrView(newView,"medium");
01227                                         }
01228                                 }
01229                         }
01230                 }
01231                 else {
01232                         this.SlideShow.changeCurrView(newView,this._currImageSize);
01233                 }
01234         
01235                 if(embedEnabled)
01236                         setHeightWidth(_parent.podHeight,_parent.podWidth);
01237                 else
01238                         this._oStageListener.onResize();
01239         }
01240         
01241         //function exposed via the External API allowing real-time styling
01242         //of gallery elements withing certain authoring flows
01243         public function livePreview(strNode:String):Void {
01244                 var styleXML:XML = new XML();
01245                 styleXML.parseXML(strNode);
01246                 var styleNode:XMLNode = styleXML.firstChild;
01247                 
01248                 livePreviewNode( styleNode );
01249         }
01250         
01251         public function livePreviewNode(styleNode:XMLNode):Void {
01252                 switch(styleNode.nodeName){
01253                         case "updateGroup":
01254                                 this.ThumbnailView.clearThumbs();
01255                                 this.SlideShow.clearMediaGroup();
01256                                 this._bSmartLoad = false;
01257                                 this.loadGroupXml(styleNode.attributes.path);
01258                                 break;
01259                         case "viewOptions":
01260                                 
01261                                 if((styleNode.attributes.startingView != "galleryScrollingBottom")&&(styleNode.attributes.startingView != "galleryScrollingLeft")&&(styleNode.attributes.startingView != "galleryDefault")&&(styleNode.attributes.startingView != "slideshowOnly")&&(styleNode.attributes.startingView != "mapView")&&(styleNode.attributes.startingView != "extensionModule"))
01262                                         styleNode.attributes.startingView = "galleryDefault";
01263                                 this.ThumbnailView.initView(styleNode.attributes.startingView,_strBaseRefUrl);
01264                                 this.ThumbnailView.parseStyleXML(XPathAPI.selectSingleNode(_xmlStyle.firstChild,"/galleryStyle/appearance/thumbnailView"));
01265                                 this.SlideShow._strViewMode = styleNode.attributes.startingView;
01266                                 this._strViewMode = styleNode.attributes.startingView;
01267                                 if(styleNode.attributes.startingView == "slideshowOnly")
01268                                         this._strCurrView = "slideshow";
01269                                 else
01270                                         this._strCurrView = "gallery";
01271                                 this.clearMenus();
01272                                 this.buildMenus();
01273                                 this.changeView(_strCurrView,this._strCurrBandwidth);
01274                                 break;
01275                         case "metadataOptions":
01276                                 this._strMetadataMode = styleNode.attributes.metadataPosition;
01277                                 this.changeView(_strCurrView,this._strCurrBandwidth);
01278                                 break;
01279 
01280                         case "mediaPosition":
01281                                 this.SlideShow._strMediaPostionType = styleNode.attributes.positionType;
01282                                 this.SlideShow._strImageScale = styleNode.attributes.imageScale;
01283                                 this.SlideShow._strVideoScale = styleNode.attributes.videoScale;
01284                                 this.SlideShow.mediaXPos = parseFloat(styleNode.attributes.x);
01285                                 this.SlideShow.mediaYPos = parseFloat(styleNode.attributes.y);
01286                                 this.SlideShow.mediaWidth = parseFloat(styleNode.attributes.width);
01287                                 this.SlideShow.mediaHeight = parseFloat(styleNode.attributes.height);
01288                                 this.changeView(_strCurrView,this._strCurrBandwidth);
01289                                 //this._bFitAtStart = fitAtStart;
01290                                 //this._bFitAtStart = fitAtStart;
01291                                 break;
01292                         case "slideTransitions":
01293                                 this.SlideShow.strTransitionType = styleNode.attributes.transition;
01294                                 var transDur:Number = parseFloat(styleNode.attributes.transitionDuration);
01295                                 if(transDur < 0)
01296                                         transDur = 0.5;
01297                                 this.SlideShow._iTransitionDuration = transDur;
01298                                 
01299                                 var slideDur:Number = parseFloat(styleNode.attributes.slideDuration);
01300                                 if((this.SlideShow._iSlideDuration != slideDur)&&(slideDur >= 1))
01301                                         this.SlideShow.resetSlideDuration(slideDur);
01302                                         
01303                                 if(embedEnabled)
01304                                         setHeightWidth(_parent.podHeight,_parent.podWidth);
01305                                 else 
01306                                         _oStageListener.onResize();
01307                                 break;
01308                         case "bandWidthOptions":
01309                                 if(styleNode.attributes.connection == "broadband"){
01310                                         for(var i:Number=0;i<this._aMenus.length;i++){
01311                                                 if (this._aMenus[i].menuHeaderEvent == "MenuConnection")
01312                                                         this._aMenus[i].setSelectedItem("MenuConnectionBroadband");
01313                                         }
01314                                         this.dispatchEvent("broadband");
01315                                 }
01316                                 else if(styleNode.attributes.connection == "dialup"){
01317                                         for(var i:Number=0;i<this._aMenus.length;i++){
01318                                                 if (this._aMenus[i].menuHeaderEvent == "MenuConnection")
01319                                                         this._aMenus[i].setSelectedItem("MenuConnectionDialup");
01320                                         }
01321                                         this.dispatchEvent("dialup");
01322                                 }       
01323                                 break;
01324                         case "playOptions":
01325                                 break;
01326                         case "backgroundBgColor" :
01327                                 this.setTint(BackgroundColor,styleNode.attributes.color,styleNode.attributes.alpha);
01328                                 break;
01329                         case "backgroundBgImg" :
01330                                 //use a MovieClipLoader to load the background jpeg of swf
01331                                 var bgLoader:MovieClipLoader = new MovieClipLoader();
01332                                 //use this class as the callback
01333                                 bgLoader.addListener(this);
01334                                 bgLoader.loadClip(this._strBaseRefUrl+styleNode.attributes.src,BackgroundImg.bgImgContainer);
01335                                 this.BackgroundImg._alpha = styleNode.attributes.alpha;
01336                                 break;
01337                         case "groupTitleString":
01338                                 this._strGroupTitle = styleNode.attributes.value;
01339                                 this.GroupTitle.setTextValue(styleNode.attributes.value);
01340                                 break;
01341                         case "contactName":
01342                                 this._strContactInfo = styleNode.attributes.value;
01343                                 break;
01344                         case "contactEmail":
01345                                 this.ContactInfo.addUrlLink("mailto:"+styleNode.attributes.value);
01346                                 this._strContactInfoLink = "mailto:"+styleNode.attributes.value;
01347                                 break;
01348                         case "contactInfoString":
01349                                 if((styleNode.attributes.value != "linkOnly")&&(styleNode.attributes.value != null))
01350                                         this._strContactInfo = styleNode.attributes.value;
01351                                 
01352                                 if((styleNode.attributes.link != "")&&(styleNode.attributes.link != null)){
01353                                         this.ContactInfo.addUrlLink(styleNode.attributes.link);
01354                                         this._strContactInfoLink = styleNode.attributes.link;
01355                                 }
01356                                 break;
01357                         case "groupDescription":
01358                                 if(styleNode.attributes.value != null)
01359                                         this.GalleryInfo.setText("<groupDescription>"+styleNode.attributes.value+"</groupDescription>");
01360                                 
01361                                 break;
01362                         case "headerBarColor" :
01363                                 this.setTint(HeaderBar,styleNode.attributes.color,styleNode.attributes.alpha);
01364                                 break;
01365                         case "headerBarEnabled" :
01366                                 if(styleNode.attributes.enabled == "true")
01367                                         this.bShowHeaderBar = true;
01368                                 else
01369                                         this.bShowHeaderBar = false;
01370                                 break;
01371                         case "menuBarEnabled" :
01372                                 if(styleNode.attributes.enabled == "true")
01373                                         this.bShowMenuBar = true;
01374                                 else
01375                                         this.bShowMenuBar = false;
01376                                 break;
01377                         case "headerBarColor" :
01378                                 this.setTint(HeaderBar,styleNode.attributes.color,styleNode.attributes.alpha);
01379                                 break;
01380                         case "pageTitle" :
01381                                 this._lastPageTitleStyleNode = styleNode;
01382                                 //Page Title
01383                                 this.PageTitle.txtField._alpha =styleNode.attributes.alpha;
01384                                 var txtFont:String = styleNode.attributes.fontFamily;
01385                                 var txtColor:String = "#"+styleNode.attributes.color;
01386                                 var txtSize:String = styleNode.attributes.size;
01387                                 var txtAlign:String = styleNode.attributes.align ;
01388                                 
01389                                 if(txtFont == "Myriad Web Pro")
01390                                         this.PageTitle.txtField.embedFonts = true;
01391                                 else
01392                                         this.PageTitle.txtField.embedFonts = false;
01393                                 var styles:TextField.StyleSheet = new TextField.StyleSheet();
01394                                 styles.setStyle("textStyle", {
01395                                         color:txtColor,
01396                                         fontFamily:txtFont,
01397                                         fontSize:txtSize, 
01398                                         textAlign:txtAlign
01399                                 });
01400                                 styles.setStyle("a:link", {
01401                                         color:txtColor
01402                                 });
01403                                 styles.setStyle("a:hover", {
01404                                         textDecoration:'underline'
01405                                 });
01406                                 this.PageTitle.txtField.styleSheet = styles;
01407                                 break;
01408                         case "pageTitleImg":
01409                                 if(styleNode.attributes.visible == "true"){
01410                                         this.PageTitle = this.createEmptyMovieClip("pageTitle",this.PageTitle.getDepth());
01411                                         this.PageTitle.createEmptyMovieClip("headerImage",1);
01412                                         
01413                                         var mclListener:Object = new Object();
01414                                         mclListener._parent = this;
01415                                         mclListener.onLoadInit = function(target_mc:MovieClip) {
01416                                                 if(target_mc._height > this._parent._iHeaderBarHeight){
01417                                                         var scalar:Number = (this._parent._iHeaderBarHeight/target_mc._height)*100;
01418                                                         target_mc._yscale = scalar;
01419                                                         target_mc._xscale = scalar;
01420                                                 }
01421                                                 if(this._parent.embedEnabled)
01422                                                         this._parent.setHeightWidth(this._parent._parent.podHeight,this._parent._parent.podWidth);
01423                                                 else 
01424                                                         this._parent._oStageListener.onResize();
01425                                         };
01426         
01427                                         var imgLoader:MovieClipLoader = new MovieClipLoader();
01428                                         //use this class as the callback
01429                                         imgLoader.addListener(mclListener);
01430                                         imgLoader.loadClip(this._strBaseRefUrl+styleNode.attributes.src,this.PageTitle.headerImage);
01431                                         this._bHeaderUsesGraphic = true;
01432                                 
01433                                 }
01434                                 else{
01435                                         this.PageTitle.removeMovieClip();
01436                                         this._bHeaderUsesGraphic = false;
01437                                         this.PageTitle = attachMovie("GalleryTitle","pageTitle",_iControlsDepth++,{_visible:false});
01438                                         this.PageTitle.tabEnabled = false;
01439                                         this.PageTitle.txtField.html = true;
01440                                         this.PageTitle.txtField.multiline = false;
01441                                         this.PageTitle.txtField.wordWrap = false;
01442                                         this.PageTitle.txtField.selectable = false;
01443                                         this.PageTitle.txtField.autoSize = true;
01444                                         this.PageTitle.txtField.antiAliasType = "advanced";
01445                                         this.PageTitle.enableToolTips();
01446                                         // update the style
01447                                         livePreviewNode( this._lastPageTitleStyleNode );
01448                                 }
01449                                 break;
01450                         case "pageTitleString":
01451                                 this._strPageTitle = styleNode.attributes.value;
01452                                 this.PageTitle.setTextValue(styleNode.attributes.value);
01453                                 this.PageTitle.setTextValue("DDDOK");
01454                                 break;
01455                         case "groupTitle" :
01456                                 this.GroupTitle.txtField._alpha = styleNode.attributes.alpha;
01457                                 var txtFont:String = styleNode.attributes.fontFamily;
01458                                 var txtColor:String = "#"+styleNode.attributes.color;
01459                                 var txtSize:String = styleNode.attributes.size;
01460                                 
01461                                 if(txtFont == "Myriad Web Pro")
01462                                         this.GroupTitle.txtField.embedFonts = true;
01463                                 else
01464                                         this.GroupTitle.txtField.embedFonts = false;
01465                                 
01466                                 var styles:TextField.StyleSheet = new TextField.StyleSheet();
01467                                 styles.setStyle("textStyle", {
01468                                         color:txtColor,
01469                                         fontFamily:txtFont,
01470                                         fontSize:txtSize, 
01471                                         textAlign:"right"
01472                                 });
01473                                 styles.setStyle("a:link", {
01474                                         color:txtColor
01475                                 });
01476                                 styles.setStyle("a:hover", {
01477                                         textDecoration:'underline'
01478                                 });
01479                                 
01480                                 this.GroupTitle.txtField.styleSheet = styles;
01481                                 break;
01482                         case "menuBgColor":
01483                                 
01484                                 _strMenuBarBgColor = styleNode.attributes.color;
01485                                 this.setTint(GalleryMenuBar.menuBarBg,_strMenuBarBgColor,"100");
01486                                 for(var i:Number=0;i<this._aMenus.length;i++){
01487                                         this._aMenus[i].setHeaderBgColor(styleNode.attributes.color,"100");
01488                                         this._aMenus[i].setItemsBgColor(styleNode.attributes.color);
01489                                 }
01490                                 break;
01491                         case "menuHover":
01492                                 _iMenuBarHoverColor = parseInt("0x" + styleNode.attributes.color);
01493                                 for(var i:Number=0;i<this._aMenus.length;i++){
01494                                         this._aMenus[i].setHeaderHoverColor(styleNode.attributes.color);
01495                                         this._aMenus[i].setItemsHoverColor(styleNode.attributes.color);
01496                                 }
01497                                 break;
01498                         case "menuText":
01499                                 for(var i:Number=0;i<this._aMenus.length;i++){
01500                                         this._aMenus[i].setHeaderTextColor(styleNode.attributes.color);
01501                                         this._aMenus[i].setItemsTextColor(styleNode.attributes.color);
01502                                         this._aMenus[i].setItemsBorderColor(styleNode.attributes.color,"100");
01503                                 }
01504                                 break;
01505                         case "contactInfoText":
01506                                 this.ContactInfo.txtField._alpha = styleNode.attributes.alpha;
01507                                 var txtFont:String = styleNode.attributes.fontFamily;
01508                                 var txtColor:String = "#"+styleNode.attributes.color;
01509                                 var txtSize:String = styleNode.attributes.size;
01510                                 var txtAlign:String = styleNode.attributes.align ;
01511                                 
01512                                 if(txtFont == "Myriad Web Pro")
01513                                         this.ContactInfo.txtField.embedFonts = true;
01514                                 else
01515                                         this.ContactInfo.txtField.embedFonts = false;
01516                                 
01517                                 var styles:TextField.StyleSheet = new TextField.StyleSheet();
01518                                 styles.setStyle("textStyle", {
01519                                         color:txtColor,
01520                                         fontFamily:txtFont,
01521                                         fontSize:txtSize, 
01522                                         textAlign:"right"
01523                                 });
01524                                 styles.setStyle("a:link", {
01525                                         color:txtColor
01526                                 });
01527                                 styles.setStyle("a:hover", {
01528                                         textDecoration:'underline'
01529                                 });
01530                                 
01531                                 this.ContactInfo.txtField.styleSheet = styles;
01532                                 break;
01533                         case "thumbnailViewBgColor" :
01534                                 this.ThumbnailView.livePreview("thumbViewBgColor",styleNode);
01535                                 break;
01536                         case "thumbnailViewBorder" :
01537                                 this.ThumbnailView.livePreview("thumbViewBorder",styleNode);
01538                                 break;
01539                         case "thumbBorder" :
01540                                 this.ThumbnailView.livePreview("thumbBorder",styleNode);
01541                                 break;
01542                         case "thumbHover" :
01543                                 this.ThumbnailView.livePreview("thumbHover",styleNode);
01544                                 break;
01545                         case "thumbSelected" :
01546                                 this.ThumbnailView.livePreview("thumbSelected",styleNode);
01547                                 break;
01548                         case "thumbDropShadow" :
01549                                 this.ThumbnailView.livePreview("thumbDropShadows",styleNode);
01550                                 break;
01551                         case "thumbViewCtrlText" :
01552                                 this.ThumbnailView.livePreview("thumbControlText",styleNode);
01553                                 break;
01554                         case "thumbViewBtnBorder" :
01555                                 this.ThumbnailView.livePreview("thumbCtrlBtnBorder",styleNode);
01556                                 break;
01557                         case "thumbViewBtnBackground" :
01558                                 this.ThumbnailView.livePreview("thumbCtrlBtnBg",styleNode);
01559                                 break;
01560                         case "thumbViewBtnFore" :
01561                                 this.ThumbnailView.livePreview("thumbCtrlBtnFore",styleNode);
01562                                 break;
01563                         case "metadataField" :
01564                                 this._iSlideshowMetadataHeight = parseFloat(styleNode.attributes.height);
01565                                 this.SlideShow.livePreview("metadataField",styleNode);
01566                                 break;
01567                         case "metadataFieldText" :
01568                                 //automatically set the text field height based on a scalar of 1.5 for 2 lines of text
01569                                 if(styleNode.attributes.autoSize == "true")
01570                                         this._iSlideshowMetadataHeight = parseFloat(styleNode.attributes.size) * 3;
01571                                 this.SlideShow.livePreview("metadataFieldText",styleNode);
01572                                 break;
01573                         case "slideshowBorder" :
01574                                 this.SlideShow.livePreview("slideshowBorder",styleNode);
01575                                 break;
01576                         case "slideshowBgColor" :
01577                                 this.SlideShow.livePreview("slideshowBgColor",styleNode);
01578                                 break;
01579                         case "slideshowCtrlText" :
01580                                 this.SlideShow.livePreview("slideshowCtrlText",styleNode);
01581                                 break;
01582                         case "slideshowBtnBorder" :
01583                                 this.SlideShow.livePreview("slideshowBtnBorder",styleNode);
01584                                 break;
01585                         case "slideshowBtnBackground" :
01586                                 this.SlideShow.livePreview("slideshowBtnBackground",styleNode);
01587                                 break;
01588                         case "slideshowBtnFore" :
01589                                 this.SlideShow.livePreview("slideshowBtnFore",styleNode);
01590                                 break;
01591                         case "metadataViewField" :
01592                                 this._iMetadataViewWidth = parseFloat(styleNode.attributes.widthPercentage);
01593                                 this.MetadataView.livePreview("metadataViewField",styleNode);
01594                                 break;
01595                         case "metadataViewBgColor" :
01596                                 this.MetadataView.livePreview("metadataViewBgColor",styleNode);
01597                                 break;
01598                         case "metadataViewBorder" :
01599                                 this.MetadataView.livePreview("metadataViewBorder",styleNode);
01600                                 break;
01601                         case "metadataViewTitle" :
01602                                 this.MetadataView.livePreview("metadataViewTitle",styleNode);
01603                                 break;
01604                         case "metadataViewText" :
01605                                 this.MetadataView.livePreview("metadataViewText",styleNode);
01606                                 break;
01607                         case "metadataViewBtnBorder" :
01608                                 this.MetadataView.livePreview("metadataViewBtnBorder",styleNode);
01609                                 break;
01610                         case "metadataViewBtnBackground" :
01611                                 this.MetadataView.livePreview("metadataViewBtnBackground",styleNode);
01612                                 break;
01613                         case "metadataViewBtnFore" :
01614                                 this.MetadataView.livePreview("metadataViewBtnFore",styleNode);
01615                                 break;
01616                         case "galleryInfoBgColor" :
01617                                 this.GalleryInfo.livePreview("galleryInfoBgColor",styleNode);
01618                                 break;
01619                         case "galleryInfoBorder" :
01620                                 this.GalleryInfo.livePreview("galleryInfoBorder",styleNode);
01621                                 break;
01622                         case "galleryInfoText" :
01623                                 this.GalleryInfo.livePreview("galleryInfoText",styleNode);
01624                                 break;
01625                         case "galleryInfoTextField" :
01626                                 this._iGalleryInfoHeight = parseFloat(styleNode.attributes.height);
01627                                 this._iGalleryInfoWidth = parseFloat(styleNode.attributes.width);
01628                                 break;
01629                         case "galleryInfoBtnBorder" :
01630                                 this.GalleryInfo.livePreview("galleryInfoBtnBorder",styleNode);
01631                                 break;
01632                         case "galleryInfoBtnBackground" :
01633                                 this.GalleryInfo.livePreview("galleryInfoBtnBackground",styleNode);
01634                                 break;
01635                         case "galleryInfoBtnFore" :
01636                                 this.GalleryInfo.livePreview("galleryInfoBtnFore",styleNode);
01637                                 break;
01638                         case "imageBorder" :
01639                                 this.SlideShow.livePreview("imageBorder",styleNode);
01640                                 break;
01641                         case "imageDropShadow" :
01642                                 this.SlideShow.livePreview("imageDropShadow",styleNode);
01643                                 break;
01644                         case "thumbnailViewScrollBarFill":
01645                                 this.ThumbnailView.livePreview("thumbnailViewScrollBarFill",styleNode);
01646                                 break;
01647                         case "thumbnailViewScrollBarFore":
01648                                 this.ThumbnailView.livePreview("thumbnailViewScrollBarFore",styleNode);
01649                                 break;
01650                         case "thumbnailViewScrollBarBorder":
01651                                 this.ThumbnailView.livePreview("thumbnailViewScrollBarBorder",styleNode);
01652                                 break;
01653                         case "galleryInfoScrollBarFill":
01654                                 this.GalleryInfo.livePreview("thumbnailViewScrollBarFill",styleNode);
01655                                 break;
01656                         case "galleryInfoScrollBarFore":
01657                                 this.GalleryInfo.livePreview("thumbnailViewScrollBarFore",styleNode);
01658                                 break;
01659                         case "galleryInfoScrollBarBorder":
01660                                 this.GalleryInfo.livePreview("thumbnailViewScrollBarBorder",styleNode);
01661                                 break;
01662                 }
01663                 if(embedEnabled)
01664                         setHeightWidth(_parent.podHeight,_parent.podWidth);
01665                 else 
01666                         _oStageListener.onResize();
01667                 
01668         }
01669         
01670         //ToolTip functions
01671         public function showToolTip(txt:String,toolTipPos:String,wrap:Boolean,posx:Number,posy:Number):Void{
01672                 
01673                 if(toolTipPos == "useMousePos"){
01674                         this.ToolTip._x = _xmouse;
01675                         this.ToolTip._y = _ymouse + 20;
01676                 }
01677                 else {
01678                         this.ToolTip._x = posx;
01679                         this.ToolTip._y = posy;
01680                 }
01681                 this.ToolTip.setTextValue(txt,Stage.width-this.ToolTip._x,Stage.height-this.ToolTip._y,wrap);
01682                 this.ToolTip._visible = true;
01683         }
01684         
01685         public function hideToolTip(posx:Number,posy:Number,txt:String):Void{
01686                 this.ToolTip._visible = false;
01687         }
01688         
01689         /**************************************************************
01690         ** setTint
01691         ** Sets a color object for a movieclip and then sets its tint
01692         ** allowing for ActionScript control of display colors
01693         ****************************************************************/
01694         function setTint(clip:MovieClip,hexval:String,alpha:String):Void {
01695                 hexval = "0x" + hexval;
01696                 var colorVal = parseInt(hexval);
01697                 var alphaVal = parseInt(alpha);
01698                 var color:Color = new Color(clip);
01699                 var oColorTransform:Object = new Object();
01700                 oColorTransform.ra = oColorTransform.ga = oColorTransform.ba   = 0;
01701                 oColorTransform.rb = (colorVal >> 16) & 0xFF;
01702                 oColorTransform.gb = (colorVal >> 8) & 0xFF;
01703                 oColorTransform.bb = colorVal & 0xFF;
01704                 oColorTransform.ab = ((alphaVal/100)*255)-255;
01705                 color.setTransform(oColorTransform);
01706         }
01707 
01708         /**************************************************************
01709         ** toggleDebug writeDebug
01710         ** Writes text to a pop-up debug window for debugging outside of the
01711         ** Flash authoring environment
01712         **************************************************************/
01713         private function toggleDebug():Void {
01714                 if(this._bDebugWindow){
01715                         if(this.DebugWindow._visible)
01716                                 this.DebugWindow._visible = false;
01717                         else
01718                                 this.DebugWindow._visible = true;
01719                 }
01720         }
01721         
01722         private function writeDebug(debugOut:String, area:String):Void {
01723                 trace( debugOut );
01724                 switch (area) {
01725                 case "main" :
01726                         this.DebugWindow.main.text += debugOut+newline;
01727                         break;
01728                 case "status" :
01729                         this.DebugWindow.status.text = debugOut;
01730                         break;
01731                 case "time" :
01732                         this.DebugWindow.time.text = debugOut;
01733                         break;
01734                 case "report" :
01735                         this.DebugWindow.main.text += debugOut+" | ";
01736                         break;
01737                 case "clear" :
01738                         this.DebugWindow.main.text = "";
01739                         break;
01740                 default :
01741                         this.DebugWindow.main.text += debugOut+newline;
01742                 }
01743         }
01744         
01745 
01746         /**************************************************************
01747         ** resizeStage
01748         ****************************************************************/
01749         private function resizeStage():Void {
01750 
01751                 this._parent.setHeightWidth(Stage.height,Stage.width);
01752                 
01753         }
01754         
01755         /**************************************************************
01756         ** setHeightWidth
01757         ** sets the height and width of the gallery and repositions/scales
01758         ** all UI movie clips accordingly
01759         ****************************************************************/
01760         private function setHeightWidth(p_h,p_w):Void {
01761                 iScreenWidth = p_w;
01762                 iScreenHeight = p_h;
01763                 
01764                 if(iScreenWidth < this._iMinScreenWidth)
01765                         iScreenWidth = this._iMinScreenWidth;
01766                 if(iScreenHeight < this._iMinScreenHeight)
01767                         iScreenHeight = this._iMinScreenHeight;
01768                 
01769                 //size and position UI elements
01770                 this.BackgroundColor._width = this.iScreenWidth;
01771                 this.BackgroundColor._height = this.iScreenHeight;
01772                 this.BackgroundImg._width = this.iScreenWidth;
01773                 this.BackgroundImg._height = this.iScreenHeight;
01774                 this.HeaderBar._width = this.iScreenWidth;
01775 
01776                 var ypos:Number = 0;
01777                 
01778                 //Header Bar and Menu Bar
01779                 if(this.bShowHeaderBar){
01780                         this.HeaderBar._y = 0;
01781                         ypos += this.HeaderBar._height;
01782                         if(this.bShowMenuBar){
01783                                 this.GalleryMenuBar._y = this.HeaderBar._y + this.HeaderBar._height;
01784                                 ypos += this.GalleryMenuBar._height;
01785                         }
01786                         else {
01787                                 this.GalleryMenuBar._y = -1000;
01788                         }
01789                 }
01790                 else{
01791                         if(this.bShowMenuBar){
01792                                 //show menu without header
01793                                 ypos += this.GalleryMenuBar._height;
01794                                 this.HeaderBar._y = - this.HeaderBar._height;
01795                                 this.GalleryMenuBar._y = 0;
01796                         }
01797                         else {
01798                                 this.HeaderBar._y = -1*(this.HeaderBar._height + this.GalleryMenuBar._height);
01799                                 this.GalleryMenuBar._y = -1000;
01800                         }
01801                 }
01802                 this.GalleryMenuBar.menuBarBg._width = this.iScreenWidth;
01803                 
01804                 if(this._bHeaderUsesGraphic){
01805 
01806                         if(this.PageTitle.headerImage._width > 0){
01807                                 //page title graphic
01808                                 this.PageTitle._y = this.HeaderBar._y + ((this.HeaderBar._height - this.PageTitle.headerImage._height)/2);
01809                                 
01810                                 //Group Name
01811                                 this.GroupTitle.setTextValue(this._strGroupTitle);
01812                                 if(this.GroupTitle.txtField.textWidth >  this.HeaderBar._width - this.PageTitle.headerImage._width - 20) {
01813                                         this.GroupTitle.truncateString("width",(this.HeaderBar._width - this.PageTitle.headerImage._width - 20));
01814                                 }
01815                                 this.GroupTitle._x = this.iScreenWidth - this.GroupTitle.txtField._width  - this._iGroupTitleMargin;
01816                                 this.GroupTitle._y = (this.HeaderBar._height/2) - (this.GroupTitle.txtField._height/2)+6;
01817                         }
01818 
01819                 }
01820                 else {
01821                         this.PageTitle.setTextValue(this._strPageTitle);
01822                         if(this.PageTitle.txtField.textWidth > (this.HeaderBar._width/2)-20) {
01823                                 this.PageTitle.truncateString("width",((this.HeaderBar._width/2)-20));
01824                         }
01825                         this.PageTitle._x = this._iPageTitle_x;
01826                         this.PageTitle._y = this.HeaderBar._y + ((this.HeaderBar._height/2)-(this.PageTitle.txtField._height/2)+6);
01827                         
01828                         //Group Name
01829                         this.GroupTitle.setTextValue(this._strGroupTitle);
01830                         if(this.GroupTitle.txtField.textWidth > (this.HeaderBar._width/2)-20) {
01831                                 this.GroupTitle.truncateString("width",((this.HeaderBar._width/2)-20));
01832                         }
01833                         this.GroupTitle._x = this.iScreenWidth - this.GroupTitle.txtField._width  - this._iGroupTitleMargin;
01834                         this.GroupTitle._y = this.HeaderBar._y + ((this.HeaderBar._height/2) - (this.GroupTitle.txtField._height/2)+6);
01835 
01836                 }
01837                 
01838                 
01839                 //Menus
01840                 
01841                 for (var i:Number=0;i<this._aMenus.length;i++){
01842                         if(!this.bShowMenuBar)
01843                                 this._aMenus[i]._y = -1000;
01844                         else
01845                                 this._aMenus[i]._y = this.HeaderBar._y + this.HeaderBar._height;
01846                 }
01847                 
01848                 //Contact Info
01849                 this.ContactInfo.setTextValue(this._strContactInfo);
01850                 if((this._strContactInfoLink != "") && (this._strContactInfoLink != null))
01851                         this.ContactInfo.addUrlLink(this._strContactInfoLink);
01852                 if(this.ContactInfo.txtField.textWidth > (this.HeaderBar._width/2)-100) {
01853                         this.ContactInfo.truncateString("width",((this.HeaderBar._width/2)-100));
01854                 }
01855                 this.ContactInfo._x = this.iScreenWidth - this.ContactInfo.txtField._width  - this._iGroupTitleMargin;
01856                 this.ContactInfo._y = this.GalleryMenuBar._y + (this.GalleryMenuBar._height/2) - ((this.ContactInfo.txtField._height)/2)+1;
01857                 
01858                 switch (this._strCurrView) {
01859                         
01860                         case "gallery":
01861                                 this.GalleryInfo._visible = false;
01862 
01863                                 
01864                                 //tell the SlideShow to display itself in gallery mode
01865                                 this.SlideShow.strDisplayMode = "gallery";
01866                                 
01867                                 switch (this._strViewMode) {
01868                                         case "galleryScrollingBottom":
01869                                                 if (this._strMetadataMode == "leftSide") {
01870                                                         //set the pos and height/width of thumb control
01871                                                         var iThumbnailViewWidth:Number = this.iScreenWidth-(2*this._iControlsTopSpacer);
01872                                                         var iMetadataViewWidth:Number = (this.iScreenWidth-(2*this._iControlsTopSpacer))*this._iMetadataViewWidth;
01873                                                         var iSlideshowControlWidth:Number = (this.iScreenWidth-(2*this._iControlsTopSpacer))*(1-this._iMetadataViewWidth);
01874                         
01875                                                         var iThumbnailViewHeight:Number = this._iThumbTopMargin + (2*this._iThumbBorderWidth) + this._iThumbMaxHeight + 6 +  this._iThumbScrollHeight;  
01876                                                         this.SlideShow._iSlideShowMetadataHeight = 0;
01877                                                         this.SlideShow._x = this.iScreenWidth - iSlideshowControlWidth - this._iControlsTopSpacer;
01878                                                         this.SlideShow._y = ypos + this._iControlsTopSpacer;
01879                                                         
01880                                                         this.MetadataView._x = this._iControlsTopSpacer;
01881                                                         this.MetadataView._y = ypos + this._iControlsTopSpacer;
01882                                                         
01883                                                         
01884                                                         var iSlideShowControlHeight:Number = this.iScreenHeight - this.SlideShow._y - iThumbnailViewHeight - (this._iControlsTopSpacer*2);
01885                         
01886                                                         this.ThumbnailView._x = this._iControlsSideSpacer;
01887                                                         this.ThumbnailView._y = this.SlideShow._y + iSlideShowControlHeight+ this._iControlsTopSpacer;
01888                                                         
01889                                                         //set the height and width of the controls
01890                                                         this.ThumbnailView.setHeightWidth(iThumbnailViewHeight,iThumbnailViewWidth);
01891                                                         this.SlideShow.setHeightWidth(iSlideShowControlHeight,iSlideshowControlWidth);
01892                                                         this.MetadataView.setHeightWidth(iSlideShowControlHeight,iMetadataViewWidth-this._iControlsTopSpacer);
01893                                                         
01894                                                         //make UI controls visible
01895                                                         this.ExtensionModule._visible =false;
01896                                                         this.GalleryInfo._visible = false;
01897                                                         this.BackgroundColor._visible = true;
01898                                                         this.HeaderBar._visible = true;
01899                                                         this.PageTitle._visible = true;
01900                                                         this.GroupTitle._visible = true;
01901                                                         this.ContactInfo._visible = true;
01902                                                         this.GalleryMenuBar._visible = true;
01903                                                         this.ThumbnailView._visible = true;
01904                                                         this.SlideShow._visible = true;
01905                                                         this.MetadataView._visible = true;
01906                                                         for(var i:Number=0;i<this._aMenus.length;i++)
01907                                                                 this._aMenus[i]._visible = true;
01908                                                 }
01909                                                 else {
01910                                                         
01911                                                         //set the pos and height/width of thumb control
01912                                                         var iThumbnailViewWidth:Number = this.iScreenWidth-(2*this._iControlsTopSpacer);
01913                                                         var iSlideshowControlWidth:Number = this.iScreenWidth-(2*this._iControlsTopSpacer);
01914                         
01915                                                         var iThumbnailViewHeight:Number = this._iThumbTopMargin + (2*this._iThumbBorderWidth) + this._iThumbMaxHeight + 6 +  this._iThumbScrollHeight;  
01916                                                         this.SlideShow._y = ypos + this._iControlsTopSpacer;
01917                                                         this.SlideShow._iSlideShowMetadataHeight = this._iSlideshowMetadataHeight;
01918                                                         var iSlideShowControlHeight:Number = this.iScreenHeight - this.SlideShow._y - iThumbnailViewHeight - (this._iControlsTopSpacer*2);
01919                         
01920                                                         
01921                                                         this.ThumbnailView._x = this.SlideShow._x = this._iControlsSideSpacer;
01922                                                         this.ThumbnailView._y = this.SlideShow._y + iSlideShowControlHeight+ this._iControlsTopSpacer;
01923                                                         
01924                         
01925                                                         
01926                                                         //set the height and width of the controls
01927                                                         this.ThumbnailView.setHeightWidth(iThumbnailViewHeight,iThumbnailViewWidth);
01928                                                         this.SlideShow.setHeightWidth(iSlideShowControlHeight,iSlideshowControlWidth);
01929                                                         
01930                                                         //make UI controls visible
01931                                                         this.ExtensionModule._visible =false;
01932                                                         this.GalleryInfo._visible = false;
01933                                                         this.MetadataView._visible =false;
01934                                                         this.BackgroundColor._visible = true;
01935                                                         this.HeaderBar._visible = true;
01936                                                         this.PageTitle._visible = true;
01937                                                         this.GroupTitle._visible = true;
01938                                                         this.ContactInfo._visible = true;
01939                                                         this.GalleryMenuBar._visible = true;
01940                                                         this.ThumbnailView._visible = true;
01941                                                         this.SlideShow._visible = true;
01942                                                         for(var i:Number=0;i<this._aMenus.length;i++)
01943                                                                 this._aMenus[i]._visible = true;
01944                                                         }
01945                                         break;
01946                                 case "galleryScrollingLeft":
01947                                         //set the pos and height/width of thumb control
01948                                         var iThumbnailViewWidth:Number = this._iThumbTopMargin + (2*this._iThumbBorderWidth) + this._iThumbMaxWidth + 6 +  this._iThumbScrollWidth;  
01949                                         this.SlideShow._iSlideShowMetadataHeight = this._iSlideshowMetadataHeight;
01950                                         var iSlideshowControlWidth:Number = this.iScreenWidth-(3*this._iControlsTopSpacer)-iThumbnailViewWidth;
01951 
01952                                         this.ThumbnailView._x = this._iControlsSideSpacer;
01953                                         this.ThumbnailView._y = ypos + this._iControlsTopSpacer;
01954                                         
01955                                         this.SlideShow._x = this.ThumbnailView._x + iThumbnailViewWidth + this._iControlsSideSpacer;
01956                                         this.SlideShow._y = ypos + this._iControlsTopSpacer;
01957                                         
01958                                         var iSlideShowControlHeight:Number = this.iScreenHeight - this.SlideShow._y -(this._iControlsTopSpacer*2);
01959                                         var iThumbnailViewHeight:Number = iSlideShowControlHeight;
01960                                         
01961                                         //set the height and width of the controls
01962                                         this.ThumbnailView.setHeightWidth(iThumbnailViewHeight,iThumbnailViewWidth);
01963                                         this.SlideShow.setHeightWidth(iSlideShowControlHeight,iSlideshowControlWidth);
01964 
01965                                         
01966                                         //make UI controls visible
01967                                         this.ExtensionModule._visible =false;
01968                                         this.GalleryInfo._visible = false;
01969                                         this.MetadataView._visible =false;
01970 
01971                                         this.BackgroundColor._visible = true;
01972                                         this.HeaderBar._visible = true;
01973                                         this.PageTitle._visible = true;
01974                                         this.GroupTitle._visible = true;
01975                                         this.ContactInfo._visible = true;
01976                                         this.GalleryMenuBar._visible = true;
01977                                         this.ThumbnailView._visible = true;
01978                                         this.SlideShow._visible = true;
01979                                         for(var i:Number=0;i<this._aMenus.length;i++)
01980                                                 this._aMenus[i]._visible = true;
01981                                                         
01982                                         break;
01983                                 default:
01984                                         //set the pos and height/width of thumb control
01985                                         var iThumbnailViewWidth:Number = (this.iScreenWidth - this._iControlsDividingSpacer - (2*this._iControlsSideSpacer)) * this._iThumbnailControlWidthRatio;
01986                                         
01987                                         var iThumbnailViewHeight:Number;
01988                                         //>>unused option to have thumb control grow with page height<<
01989                                         //var iThumbnailViewHeight:Number = this.iScreenHeight - this.this.HeaderBar._height - this.this._iControlsTopSpacer);
01990                                         
01991                                         //set the pos and height/width of slideshow control
01992                                         //the max height should only be the ControlHeightRatio of the width
01993                                         this.SlideShow._iSlideShowMetadataHeight = this._iSlideshowMetadataHeight;
01994                                         var iSlideshowControlWidth:Number = this.iScreenWidth - iThumbnailViewWidth - this._iControlsDividingSpacer - (2*this._iControlsSideSpacer);
01995                                         iSlideShowControlHeight = iSlideshowControlWidth * this._iControlsHeightRatio;
01996                 
01997                                         //check if screen height is too small for controls
01998                                         if(this.iScreenHeight - this.HeaderBar._height-this.GalleryMenuBar._height- (2*this._iControlsTopSpacer) < iSlideShowControlHeight){
01999                                                 //adjust the control height to fit screen
02000                                                 iSlideShowControlHeight = this.iScreenHeight - this.HeaderBar._height-this.GalleryMenuBar._height- (2*this._iControlsTopSpacer);
02001                                         }
02002                                         
02003                                         //set thumb control height same as slideshow
02004                                         iThumbnailViewHeight = iSlideShowControlHeight;
02005                                         
02006                                         //set the x and y of the controls
02007                                         this.ThumbnailView._x = this._iControlsSideSpacer;
02008                                         this.ThumbnailView._y = ypos + this._iControlsTopSpacer;
02009                                         this.SlideShow._x = this.ThumbnailView._x + iThumbnailViewWidth + this._iControlsDividingSpacer;
02010                                         this.SlideShow._y = ypos + this._iControlsTopSpacer;
02011                                 
02012                                         //set the height and width of the controls
02013                                         this.ThumbnailView.setHeightWidth(iThumbnailViewHeight,iThumbnailViewWidth);
02014                                         this.SlideShow.setHeightWidth(iSlideShowControlHeight,iSlideshowControlWidth);
02015                                         
02016                                         //make UI controls visible
02017                                         this.ExtensionModule._visible =false;
02018                                         this.GalleryInfo._visible = false;
02019                                         this.MetadataView._visible =false;
02020                                         this.BackgroundColor._visible = true;
02021                                         this.HeaderBar._visible = true;
02022                                         this.PageTitle._visible = true;
02023                                         this.GroupTitle._visible = true;
02024                                         this.ContactInfo._visible = true;
02025                                         this.GalleryMenuBar._visible = true;
02026                                         this.ThumbnailView._visible = true;
02027                                         this.SlideShow._visible = true;
02028                                         for(var i:Number=0;i<this._aMenus.length;i++)
02029                                                 this._aMenus[i]._visible = true;
02030                                 }
02031                                 break;
02032                         case "slideshow":
02033                                 if (this._strMetadataMode == "leftSide") {
02034                                         //set the pos and height/width of thumb control
02035                                         var iMetadataViewWidth:Number = (this.iScreenWidth-(2*this._iControlsTopSpacer))*this._iMetadataViewWidth;
02036                                         var iSlideshowControlWidth:Number = (this.iScreenWidth-(2*this._iControlsTopSpacer))*(1-this._iMetadataViewWidth);
02037                                         this.SlideShow._iSlideShowMetadataHeight = 0;
02038                                         this.SlideShow._x = this.iScreenWidth - iSlideshowControlWidth - this._iControlsTopSpacer;
02039                                         this.SlideShow._y = ypos + this._iControlsTopSpacer;
02040                                         
02041                                         this.MetadataView._x = this._iControlsTopSpacer;
02042                                         this.MetadataView._y = ypos + this._iControlsTopSpacer;
02043                                         
02044                                         
02045                                         var iSlideShowControlHeight:Number = this.iScreenHeight - this.SlideShow._y - (this._iControlsTopSpacer*2);
02046         
02047                                         
02048                                         //set the height and width of the controls
02049                                         
02050                                         this.SlideShow.setHeightWidth(iSlideShowControlHeight,iSlideshowControlWidth);
02051                                         this.MetadataView.setHeightWidth(iSlideShowControlHeight,iMetadataViewWidth-this._iControlsTopSpacer);
02052                                         
02053                                         //make UI controls visible
02054                                         this.ExtensionModule._visible =false;
02055                                         this.GalleryInfo._visible = false;
02056                                         this.BackgroundColor._visible = true;
02057                                         this.HeaderBar._visible = true;
02058                                         this.PageTitle._visible = true;
02059                                         this.GroupTitle._visible = true;
02060                                         this.ContactInfo._visible = true;
02061                                         this.GalleryMenuBar._visible = true;
02062                                         this.ThumbnailView._visible = false;
02063                                         this.SlideShow._visible = true;
02064                                         this.MetadataView._visible = true;
02065                                         for(var i:Number=0;i<this._aMenus.length;i++)
02066                                                 this._aMenus[i]._visible = true;
02067                                         
02068                                         
02069                                 }
02070                                 else {
02071                                 
02072                                         this.GalleryInfo._visible = false;
02073                                         
02074                                         //tell the slideshow to display itself in slideshow mode
02075                                         this.SlideShow.strDisplayMode = "slideshow";
02076                                         this.ThumbnailView._visible = false;
02077                                         this.ThumbnailView._y = - 1000;
02078                                         
02079                                         //move and scale slideshow control
02080                                         this.SlideShow._iSlideShowMetadataHeight = this._iSlideshowMetadataHeight;
02081                                         this.SlideShow._x = this._iControlsSideSpacer;
02082                                         this.SlideShow._y = ypos + this._iControlsTopSpacer;
02083                                         iSlideShowControlHeight = this.iScreenHeight - ypos - (2*this._iControlsTopSpacer);
02084                                         this.SlideShow.setHeightWidth(iSlideShowControlHeight,this.iScreenWidth-(2*this._iControlsTopSpacer));
02085                                         
02086                                         //make UI controls visible
02087                                         this.MetadataView._visible = false;
02088                                         this.ExtensionModule._visible =false;
02089                                         this.GalleryInfo._visible = false;
02090                                         this.BackgroundColor._visible = true;
02091                                         this.HeaderBar._visible = true;
02092                                         this.PageTitle._visible = true;
02093                                         this.GroupTitle._visible = true;
02094                                         this.ContactInfo._visible = true;
02095                                         this.GalleryMenuBar._visible = true;
02096                                         this.MetadataView._visible = false;
02097                                         this.ThumbnailView._visible = false;
02098                                         this.SlideShow._visible = true;
02099                                         for(var i:Number=0;i<this._aMenus.length;i++)
02100                                                 this._aMenus[i]._visible = true;
02101                                 }
02102                                 
02103                                 break;
02104                         case "about" :
02105                                 this.SlideShow._visible = false;
02106                                 this.ThumbnailView._visible = false;
02107                                 this.MetadataView._visible = false;
02108                                 this.ExtensionModule._visible =false;
02109                                 
02110                                 //move and scale gallery info control
02111                                 var galInfoHeight:Number = this._iGalleryInfoHeight;
02112                                 var galInfoWidth:Number = this._iGalleryInfoWidth;
02113                                 if(p_h-(this.HeaderBar._height + this.GalleryMenuBar._height + (2*this._iControlsTopSpacer)) < this._iGalleryInfoHeight)
02114                                         galInfoHeight = p_h-(this.HeaderBar._height + this.GalleryMenuBar._height + (2*this._iControlsTopSpacer));
02115                                 if(p_w < this._iGalleryInfoWidth)
02116                                         galInfoWidth = p_w;
02117                                 this.GalleryInfo.setHeightWidth(galInfoHeight,galInfoWidth);
02118                                 this.GalleryInfo._x = (p_w/2) - (this.GalleryInfo._width/2);
02119                                 this.GalleryInfo._y = this.HeaderBar._height + this.GalleryMenuBar._height + this._iControlsTopSpacer;
02120                                 var controlHeight:Number = this.iScreenHeight - this.HeaderBar._height-this.GalleryMenuBar._height- (2*this._iControlsTopSpacer);
02121                                 
02122                                 this.GalleryInfo._visible = true;
02123                                 break;
02124                         case "map" :
02125                                 //make UI controls visible
02126                                 this.BackgroundColor._visible = true;
02127                                 this.HeaderBar._visible = true;
02128                                 this.PageTitle._visible = true;
02129                                 this.GroupTitle._visible = true;
02130                                 this.ContactInfo._visible = true;
02131                                 this.GalleryInfo._visible = false;
02132                                 this.GalleryMenuBar._visible = true;
02133                                 this.ThumbnailView._visible = false;
02134                                 this.MetadataView._visible = false;
02135                                 this.SlideShow._visible = false;
02136                                 for(var i:Number=0;i<this._aMenus.length;i++)
02137                                         this._aMenus[i]._visible = true;
02138                                 
02139                                 this.ExtensionModule._x = this._iControlsSideSpacer;
02140                                 this.ExtensionModule._y = this.HeaderBar._height + this.GalleryMenuBar._height + this._iControlsTopSpacer;
02141                                 var controlHeight:Number = this.iScreenHeight - this.HeaderBar._height-this.GalleryMenuBar._height- (2*this._iControlsTopSpacer);
02142                                 this.ExtensionModule.setHeightWidth(controlHeight,this.iScreenWidth-(2*this._iControlsTopSpacer));
02143                                 this.ExtensionModule._visible = true;
02144                                 
02145                                 break;
02146                         
02147                 }
02148         }
02149 }

Copyright © 2006 Adobe Systems Incorporated.

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