package net.fdms.Function 
{
	import net.fdms.Action.Action;
	import net.fdms.Action.ResControl;
	import net.fdms.Frame.Space;
	import net.fdms.Resource.Resource;
	/**
	 * ...
	 * @author ...
	 */
	public class FlowControl 
	{
		
		public function FlowControl() 
		{
			
		}
		
		/**
		 * 显示素材队列
		 * @param	resQueue
		 */
		public static function showQueue(resQueue:Array):void {
			var n:int = resQueue.length;
			for (var a:int = 0; a < n; a++) {
				var config:Object = Resource.getConfig(resQueue[a].toString());

/*				if (config.space) {
					removeSpace(config)
				}else {*/
					preAction(config);
				//}
			}
		}
		
		/**
		 * 显示对象
		 * @param	config
		 */
		private static function showRes(config:Object):void {
			ResControl.showRes(config.id);
			action(config);
		}
		
		private static function preAction(config:Object):void {
			if (config.preAction) {
				Action.addAction(config.preAction);
				Action.start(showRes, config);
			}else {
				showRes(config);
			}
		}
		
		private static function action(config:Object):void {
			if (config.action) {
				Action.addAction(config.action);
				Action.start(null);
			}
			
		}
		
		
	}

}