package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	import net.fdms.Action.MouseAction;
	import net.fdms.fdms;
	import net.fdms.Frame.*;
	import net.fdms.Function.Align.AlignSets;
	import net.fdms.Resource.ProgressBar;
	import flash.events.MouseEvent;
	
	/**
	 * 2011/5/26 14:39
	 * @author Dawnboy
	 */
	public class Main extends Sprite 
	{
		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
			
			//初始化鼠标事件
			MouseAction.RegMouseAction(OpenMouse, CloseMouse);
			MouseAction.MouseActionOn();
			
			Frame.init(addChild(new Sprite()), stage, addChild(new Sprite()));		//初始化框架
			ProgressBar.Init(Frame.Control);										//进度条初始化
			StageSets.init(this.stage);												//初始化场景设置
			StageSets.addResizeFunc(AlignSets.align);
			
			var foo:Object = { ResSets:"ResSets.xml", DataSets:"UserInfo.xml",page:"cloumn:diary" };	//模拟传值
			//fdms.init(this.loaderInfo.parameters);
			fdms.init(foo);
		}
		
		private function OpenMouse():void {
			CloseMouse();
			addEventListener(MouseEvent.CLICK, MouseAction.BtnAction);
			addEventListener(MouseEvent.MOUSE_OVER, MouseAction.OverAction);
			addEventListener(MouseEvent.MOUSE_OUT, MouseAction.OutAction);
		}
		
		private function CloseMouse():void {
			removeEventListener(MouseEvent.CLICK, MouseAction.BtnAction);
			removeEventListener(MouseEvent.MOUSE_OVER, MouseAction.OverAction);
			removeEventListener(MouseEvent.MOUSE_OUT, MouseAction.OutAction);
			
		}
		
		
	}
	
}