package com.anvsoft.data
{
	/**
	 * ...
	 * @author John Zhang
	 */
		
	 
	 
	///////test demo style////////
	public class Data
	{
		/////flashConfig/////
		private var _copyright:String;
		/////flashConfig-swf///////////
		private var _movieWidth:int;
		private var _movieHeight:int;
		private var _templateWidth:int;
		private var _templateHeight:int;
		private var _backgroundColor:uint;
		private var _scaleMode:String;
		private var _alignMode:String;
		private var _hideAdobeMenu:String;
		private var _frameRate:int;
		private var _anvsoftMenu:String;
		
		/////flashConfig-mode////////
		private var _startAutoPlay:String;
		private var _continuum:String;
		private var _clickToAutoPlay:String;
		private var _enableURL:String;
		private var _enableKeyboardShortcuts:String;
		private var _randomPlayingPhotos:String;
		private var _defineTransitionArray:Array = new Array();
		
		/////flashConfig-img/////////////
		private var _photoBgColor:uint;
		private var _photoBgAlpha:Number;
		private var _photoScaleStyle:String;
		
		/////flashConfig-preloader////////
		private var _preloaderTextColor:uint;
		private var _preloaderBgColor:uint;
		private var _preloaderBgAlpha:Number;
		
		///////playData-template//////
		private var _templateType:String;
		private var _templateSize:uint;
		private var _templateUrl:String;
		
		/////playData-template-component/////
		private var _componentType:Array = new Array();
		/////playData-template-component-property/////
		private var _componentX:Array = new Array();
		private var _componentY:Array = new Array();
		private var _componentWidth:Array = new Array();
		private var _componentHeight:Array = new Array();
		private var _componentXscale:Array = new Array();
		private var _componentYscale:Array = new Array();
		private var _componentRotation:Array = new Array();
		private var _componentAlpha:Array = new Array();
		private var _componentDepth:Array = new Array();
		
		/////playData-template-component-info/////
		private var _componentURL:Array = new Array();
		private var _componentTeData:Array = new Array();
		/////playData-template-component-hyperlink/////
		private var _componentHyperLink:Array = new Array();
		private var _componentURLTarget:Array = new Array();
		///////playData-album-slide-info//////
		private var _thumbnailArray:Array = new Array();
		private var _photoArray:Array = new Array();
		private var _videoArray:Array = new Array();
		private var _transitionArray:Array = new Array();
		private var _photoPanzoom:Array = new Array();
		private var _URLTarget:Array = new Array();
		private var _photoTimeArray:Array = new Array();
		private var _transitionTimeArray:Array = new Array();
		private var _photoUrlArray:Array = new Array();
		private var _photoTitleArray:Array = new Array();
		private var _photoWidthArray:Array = new Array();
		private var _photoHeightArray:Array = new Array();
		private var _descriptionText:Array = new Array();
		///////playData-album-slide-movieClip-component-type//////
		private var _clipArtType:Array = new Array;
		///////playData-album-slide-movieClip-component-property//////
		private var _clipArtX:Array = new Array();
		private var _clipArtY:Array = new Array();
		private var _clipArtWidth:Array = new Array();
		private var _clipArtHeight:Array = new Array();
		private var _clipArtXscale:Array = new Array();
		private var _clipArtYscale:Array = new Array();
		private var _clipArtRotation:Array = new Array();
		private var _clipArtAlpha:Array = new Array();
		private var _clipArtDepth:Array = new Array();
		///////playData-album-slide-movieClip-component-info//////
		private var _clipArtTeData:Array = new Array;
		///////playData-album-slide-movieClip-component-hyperlink//////
		private var _clipArtHyperLink:Array = new Array();
		private var _clipArtURLTarget:Array = new Array();
		///////playData-music-property///////////
		private var _bufferTime:int;
		private var _defaultVolume:Number;
		private var _musicLoop:String;
		///////playData-music-info///////////
		private var _musicUrl:String;
		/////////////
		private var _dataLength:uint;
		private var _slideLength:uint;
		/////////////////
		public function Data()
		{
			var xmlData:XmlData = new XmlData();
			var flashConfigXml:XML = new XML(xmlData.configXml);
			var playDataXml:XML = new XML(xmlData.dataXml);
			var playDataList:XMLList = playDataXml.children();
			this._dataLength = playDataList.length();
			
			/////flashConfig/////
			this._copyright = flashConfigXml.@copyright;
			/////flashConfig-swf////////
			var configSwfList:XMLList=flashConfigXml.swf;
			this._movieWidth = int(configSwfList.@movieWidth);
			this._movieHeight = int(configSwfList.@movieHeight);
			this._templateWidth = int(configSwfList.@templateWidth);
			this._templateHeight = int(configSwfList.@templateHeight);
			this._backgroundColor = uint(configSwfList.@backgroundColor);
			this._scaleMode = configSwfList.@scaleMode;
			this._alignMode = configSwfList.@alignMode;
			this._hideAdobeMenu = configSwfList.@hideAdobeMenu;
			this._frameRate = int(configSwfList.@frameRate);
			this._anvsoftMenu = configSwfList.@anvsoftMenu;
			
			/////flashConfig-mode////////
			var configModeList:XMLList=flashConfigXml.mode;
			this._startAutoPlay = configModeList.@startAutoPlay;
			this._continuum = configModeList.@continuum;
			this._clickToAutoPlay = configModeList.@clickToAutoPlay;
			this._enableURL = configModeList.@enableURL;
			this._enableKeyboardShortcuts = configModeList.@enableKeyboardShortcuts;
			this._randomPlayingPhotos = configModeList.@randomPlayingPhotos;
			var defineTransition:String = String(configModeList.@transitionArray);
			if (defineTransition == "")
			{
			   this._defineTransitionArray = null;
			}else{
			   this._defineTransitionArray = defineTransition.split(",");
			}
			/////flashConfig-img/////////////
			var configImgList:XMLList = flashConfigXml.img;
			this._photoBgColor = uint(configImgList.@photoBgColor);
			this._photoBgAlpha = Number(configImgList.@photoBgAlpha);
			this._photoScaleStyle = configImgList.@photoScaleStyle;
			
			/////flashConfig-preloader////////
			var configPreloaderList:XMLList = flashConfigXml.preloader;
			this._preloaderTextColor = uint(configPreloaderList.@textColor);
			this._preloaderBgColor = uint(configPreloaderList.@bgColor);
			this._preloaderBgAlpha = Number(configPreloaderList.@bgAlpha);
			
			///////playData-template//////
			var templateXml:XML = playDataList[0];
			this._templateType = templateXml.@type;
			this._templateSize = uint(templateXml.@size);
			this._templateUrl = templateXml.@url;
			
			/////playData-template-component/////
			var componentList:XMLList = templateXml.children();
			var componentLength:uint = componentList.length();
			for (var i:uint = 0; i < componentLength; i++)
			{
				/////playData-template-component/////
				this._componentType[i] = componentList[i].@type;
				/////playData-template-component-property/////
				var comPropertyList:XMLList = componentList[i].property;
				this._componentX[i] = comPropertyList.@x;
				this._componentY[i] = comPropertyList.@y;
				this._componentWidth[i] = comPropertyList.@width;
				this._componentHeight[i] = comPropertyList.@height;
				this._componentXscale[i] = comPropertyList.@scaleX;
				this._componentYscale[i] = comPropertyList.@scaleY;
				this._componentRotation[i] = comPropertyList.@rotation;
				this._componentAlpha[i] = comPropertyList.@alpha;
				this._componentDepth[i] = comPropertyList.@depth;
				
				/////playData-template-component-info/////
				var infoList:XMLList = componentList[i].info;
				this._componentURL[i] = infoList.@url;
				var componentTeList:XMLList = infoList.textData;
				this._componentTeData[i] = new XML(componentTeList.toXMLString());
				//trace("i:" + i + "\n" + this._componentTeData + "/n");
				/////playData-template-component-hyperlink/////
				var comHyperlinkList:XMLList = componentList[i].hyperlink;
				this._componentHyperLink[i] = comHyperlinkList.@url;
				this._componentURLTarget[i] = comHyperlinkList.@target;
				
			}
			///////playData-album//////
			if (this._dataLength > 1)
			{
				var albumXml:XML = playDataList[1];
				var slideList:XMLList = albumXml.children();
				this._slideLength = slideList.length();
				for (var j:uint = 0; j < this._slideLength; j++)
				{
					///////playData-album-slide-info//////
					var slideInfoList:XMLList = slideList[j].info;
					this._thumbnailArray[j] = slideInfoList.@jpegURL;
					this._photoArray[j] = slideInfoList.@d_URL;
					this._videoArray[j] = slideInfoList.@v_URL;
					this._transitionArray[j] = slideInfoList.@transition;
					this._photoPanzoom[j] = slideInfoList.@panzoom;
					this._URLTarget[j] = slideInfoList.@URLTarget;
					this._photoTimeArray[j] = slideInfoList.@phototime;
					this._transitionTimeArray[j] = slideInfoList.@transitiontime;
					this._photoUrlArray[j] = slideInfoList.@url;
					this._photoTitleArray[j] = slideInfoList.@title;
					this._photoWidthArray[j] = slideInfoList.@width;
					this._photoHeightArray[j] = slideInfoList.@height;
					this._descriptionText[j] = slideInfoList.toString();
					
					///////playData-album-slide-movieClip//////
					var slideMovieClipList:XMLList = slideList[j].movieClip;
					///////playData-album-slide-movieClip-component//////
					var clipArtList:XMLList = slideMovieClipList.children();
					var clipArtListLength:uint = clipArtList.length();
					///////new Array playData-album-slide-movieClip-component-type//////
					this._clipArtType[j] = new Array;
					///////new Array playData-album-slide-movieClip-component-property//////////////////
					this._clipArtX[j] = new Array();
					this._clipArtY[j] = new Array();
					this._clipArtWidth[j] = new Array();
					this._clipArtHeight[j] = new Array();
					this._clipArtXscale[j] = new Array();
					this._clipArtYscale[j] = new Array();
					this._clipArtRotation[j] = new Array();
					this._clipArtAlpha[j] = new Array();
					this._clipArtDepth[j] = new Array();
					///////new Array playData-album-slide-movieClip-component-info//////
					this._clipArtTeData[j] = new Array();
					///////new Array playData-album-slide-movieClip-component-property-hyperlink//////
					this._clipArtHyperLink[j] = new Array();
					this._clipArtURLTarget[j] = new Array();
					
					/////////////end new Array//////////////////////////////////////////////////////
					for (var k:uint = 0; k < clipArtListLength; k++)
					{
						///////playData-album-slide-movieClip-component-type//////
						this._clipArtType[j][k] = clipArtList[k].@type;
						///////playData-album-slide-movieClip-component-property//////
						var clipPropertyList:XMLList = clipArtList[k].property;
						this._clipArtX[j][k] = clipPropertyList.@x;
						this._clipArtY[j][k] = clipPropertyList.@y;
						this._clipArtWidth[j][k] = clipPropertyList.@width;
						this._clipArtHeight[j][k] = clipPropertyList.@height;
						this._clipArtXscale[j][k] = clipPropertyList.@scaleX;
						this._clipArtYscale[j][k] = clipPropertyList.@scaleY;
						this._clipArtRotation[j][k] = clipPropertyList.@rotation;
						this._clipArtAlpha[j][k] = clipPropertyList.@alpha;
						this._clipArtDepth[j][k] = clipPropertyList.@depth;
						///////playData-album-slide-movieClip-component-info//////
						var clipInfoList:XMLList = clipArtList[k].info;
						var clipArtTeList:XMLList = clipInfoList.textData;
						this._clipArtTeData[j][k] = new XML(clipArtTeList.toXMLString());
						//trace("j: " + j + "  " + "k: " + k + ":" + "\n" + clipInfoList.textData + "\n");
						///////playData-album-slide-movieClip-component-hyperlink//////
						var clipHyperlinkList:XMLList = clipArtList[k].hyperlink;
						this._clipArtHyperLink[j][k] = clipHyperlinkList.@url;
						this._clipArtURLTarget[j][k] = clipHyperlinkList.@target;
					}
					
				}
				///////playData-music//////
				if (this._dataLength > 2)
				{
					var musicXml:XML = playDataList[2];
					///////playData-music-property///////////
					var musicPropertyList:XMLList = musicXml.property;
					this._bufferTime = int(musicPropertyList.@bufferTime);
					this._defaultVolume = Number(musicPropertyList.@defaultVolume);
					this._musicLoop = musicPropertyList.@loop;
					
					///////playData-music-info///////////
					var musicInfoList:XMLList = musicXml.info;
					this._musicUrl = musicInfoList.@url;
					
				}
				
			}
			
			//trace(componentX[0]);
			//trace(this._componentURL[0]);
		}
		
		/////flashConfig/////
		public function get copyright():String
		{
			return this._copyright;
		}
		/////flashConfig-swf///////////
		public function get movieWidth():int
		{
			return this._movieWidth;
		}
		public function get movieHeight():int
		{
			return this._movieHeight;
		}
		public function get templateWidth():int
		{
			return this._templateWidth;
		}
		public function get templateHeight():int
		{
			return this._templateHeight;
		}
		public function get backgroundColor():uint
		{
			return this._backgroundColor;
		}
		public function get scaleMode():String
		{
			return this._scaleMode;
		}
		public function get alignMode():String
		{
			return this._alignMode;
		}
		public function get hideAdobeMenu():String
		{
			return this._hideAdobeMenu;
		}
		public function get frameRate():int
		{
			if (this._frameRate > 0 && this._frameRate < 120)
			{
				return this._frameRate;
			}
			else
			{
				return 30;
			}
		}
		public function get anvsoftMenu():String
		{
			return this._anvsoftMenu;
		}
		/////flashConfig-mode////////
		public function get startAutoPlay():String
		{
			return this._startAutoPlay;
		}
		public function get continuum():String
		{
			return this._continuum;
		}
		public function get clickToAutoPlay():String
		{
			return this._clickToAutoPlay;
		}
		public function get enableURL():String
		{
			return this._enableURL;
		}
		public function get enableKeyboardShortcuts():String
		{
			return this._enableKeyboardShortcuts;
		}
		public function get randomPlayingPhotos():String
		{
			return this._randomPlayingPhotos;
		}
		public function get defineTransitionArray():Array
		{
			return this._defineTransitionArray;
		}
		
		/////flashConfig-img/////////////
		public function get photoBgColor():uint
		{
			return this._photoBgColor;
		}
		public function get photoBgAlpha():Number
		{
			return this._photoBgAlpha;
		}	
		public function get photoScaleStyle():String
		{
			return this._photoScaleStyle;
		}
		/////flashConfig-preloader////////
		public function get preloaderTextColor():uint
		{
			return this._preloaderTextColor;
		}
		public function get preloaderBgColor():uint
		{
			return this._preloaderBgColor;
		}
		public function get preloaderBgAlpha():Number
		{
			if (this._preloaderBgAlpha >= 0 && this._preloaderBgAlpha <= 100)
			{
				return this._preloaderBgAlpha / 100;
			}else {
				return 1;
			}
		}
		///////playData-template//////
		public function get templateType():String
		{
			return this._templateType;
		}
		public function get templateSize():uint
		{
			return this._templateSize;
		}
		public function get templateUrl():String
		{
			return this._templateUrl;
		}
		
		/////playData-template-component/////
		public function get componentType():Array
		{
			return this._componentType;
		}
		
		
		/////playData-template-component-property/////
		public function get componentX():Array
		{
			return this._componentX;
		}
		
		public function get componentY():Array
		{
			return this._componentY;
		}
		public function get componentWidth():Array
		{
			return this._componentWidth;
		}
		public function get componentHeight():Array
		{
			return this._componentHeight;
		}
		public function get componentXscale():Array
		{
			return this._componentXscale;
		}
		public function get componentYscale():Array
		{
			return this._componentYscale;
		}
		public function get componentRotation():Array
		{
			return this._componentRotation;
		}
		public function get componentAlpha():Array
		{
			return this._componentAlpha;
		}
		public function get componentDepth():Array
		{
			return this._componentDepth;
		}
		
		/////playData-template-component-info/////
		public function get componentURL():Array
		{
			return this._componentURL;
		}
		public function get componentTeData():Array
		{
			return this._componentTeData;
		}
		
		/////playData-template-component-hyperlink/////
		public function get componentHyperLink():Array
		{
			return this._componentHyperLink;
		}
		public function get componentURLTarget():Array
		{
			return this._componentURLTarget;
		}
		///////playData-album-slide-info//////
		public function get thumbnailArray():Array 
		{
			return this._thumbnailArray;
		}
		public function get photoArray():Array 
		{
			return this._photoArray;
		}
		public function get videoArray():Array
		{
			return this._videoArray;
		}
		public function get transitionArray():Array 
		{
			return this._transitionArray;
		}
		public function get photoPanzoom():Array
		{
			return this._photoPanzoom;
		}
		public function get URLTarget():Array 
		{
			return this._URLTarget;
		}
		public function get photoTimeArray():Array 
		{
			return this._photoTimeArray;
		}
		public function get transitionTimeArray():Array 
		{
		return this._transitionTimeArray;
	    }
		public function get photoUrlArray():Array 
		{
			return this._photoUrlArray;
		}
		public function get photoTitleArray():Array 
		{
			return this._photoTitleArray;
		}
		public function get photoWidthArray():Array 
		{
			return this._photoWidthArray;
		}
		public function get photoHeightArray():Array
		{
			return this._photoHeightArray;
		}
		public function get descriptionText():Array
		{
			return this._descriptionText;
		}
		///////playData-album-slide-movieClip-component-type//////
		public function get clipArtType():Array
		{
			return this._clipArtType;
		}
		///////playData-album-slide-movieClip-component-property//////
		public function get clipArtX():Array
		{
			return this._clipArtX;
		}
		public function get clipArtY():Array
		{
			return this._clipArtY;
		}
		public function get clipArtWidth():Array
		{
			return this._clipArtWidth;
		}
		public function get clipArtHeight():Array
		{
			return this._clipArtHeight;
		}
		public function get clipArtXscale():Array
		{
			return this._clipArtXscale;
		}
		public function get clipArtYscale():Array
		{
			return this._clipArtYscale;
		}
		public function get clipArtRotation():Array
		{
			return this._clipArtRotation;
		}
		public function get clipArtAlpha():Array
		{
			return this._clipArtAlpha;
		}
		public function get clipArtDepth():Array
		{
			return this._clipArtDepth;
		}
		///////playData-album-slide-movieClip-component-info//////
		public function get clipArtTeData():Array
		{
			return this._clipArtTeData;
		}
		///////playData-album-slide-movieClip-component-hyperlink//////
		public function get clipArtHyperLink():Array
		{
			return this._clipArtHyperLink;
		}
		public function get clipArtURLTarget():Array
		{
			return this._clipArtURLTarget;
		}
		///////playData-music-property///////////
		public function get bufferTime():int
		{
			return this._bufferTime;
		}
		public function get defaultVolume():Number
		{
			if (this._defaultVolume >= 0 && this._defaultVolume <= 150)
			{
				return this._defaultVolume / 100;
			}else {
				return 0.8;
			}
		}
		public function get musicLoop():String
		{
			return this._musicLoop;
		}
		///////playData-music-info///////////
		public function get musicUrl():String
		{
			return this._musicUrl;
		}
		///////////////////////////////////////
		public function get dataLength():uint
		{
			return this._dataLength;
		}
		public function get slideLength():uint
		{
			return this._slideLength;
		}
		///////////
	}
	/////////////////////////////////////
	
}