www.pudn.com > photoFlow_AS3_001.rar > SelectionSystem.as


package com.flashloaded.as3{ 
	import com.flashloaded.as3.Collection; 
	import com.flashloaded.as3.ExternalDataLoader; 
	import com.flashloaded.as3.Iterator; 
	import com.flashloaded.as3.Item; 
	import flash.display.Sprite; 
	 
	import flash.events.Event; 
	 
	public class SelectionSystem extends ExternalDataLoader{ 
		 
		protected var _inited:Boolean=false; 
		protected var _currIndex:int=0; 
		protected var _itemsParent:Sprite; 
		 
		public function SelectionSystem(){ 
			initComp(); 
		} 
		 
		override protected function createChildren() :void{ 
			 
		} 
		 
		override protected function draw() :void{ 
			//init data 
			prepareItemsData(); 
		} 
		 
		private function attachItems():void{ 
			 
			var itr:Iterator=listItems.iterator(); 
			 
			while(itr.hasNext()){ 
				 
				items.addItem(createItem(itr.next(),itr.currentIndex()-1)); 
				 
			} 
			 
			addChilds(); 
			startCreateImages(); 
			_inited=true; 
			listItems=null; 
			onInited(); 
		} 
		 
		protected function onInited():void{ 
			//override 
			 
		} 
		 
		protected function removeItem(item:*):void{ 
			if(!inited){ 
				if(item is Object){ 
					listItems.removeItem(item); 
				} 
			}else{ 
				var itm:Item; 
				if(item is int){ 
					itm=Item(items.getItemAt(item)); 
				}else{ 
					itm=Item(items.getItem(item)); 
					 
				} 
				if(itm!=null){ 
					if(itm.index