package pages{
	import jp.progression.casts.*;
	import jp.progression.commands.display.*;
	import jp.progression.commands.lists.*;
	import jp.progression.commands.net.*;
	import jp.progression.commands.tweens.*;
	import jp.progression.commands.*;
	import jp.progression.data.*;
	import jp.progression.events.*;
	import jp.progression.scenes.*;
	import jp.progression.commands.lists.*;

	import flash.display.Loader;
	import flash.net.URLRequest;
	/**
	 * ...2009.10.22
	 * @author ...oshige
	 */
	public class ThePage extends CastMovieClip {
		private var _url:String;
		public function ThePage(initObject:Object=null) {
			// 親クラスを初期化します。
			super(initObject);
			_url = initObject.url;
		}
		private function loadSWF():void {
			//pageコンテンツをURLから読み込む（swf、画像）
			var ldswf:LoadSWF = new LoadSWF(new URLRequest(_url));
			ldswf.onProgress = function():void {
			 	trace(ldswf.bytesLoaded + " / " + ldswf.bytesTotal + " (" + ldswf.percent + "%)" );
			};
			ldswf.onComplete = function():void{
				addChild(this.loader);
			};
			ldswf.execute();
		}
		protected override function atCastAdded():void {
			addCommand(
			   new Prop(this,{x:20,y:-stage.stageHeight}),
			   //swf読み込み
			   new Func(loadSWF),
			   new DoTweener( this, { y:20,time:1, transition:"easeinoutsin"} )
			);
		}
		//
		protected override function atCastRemoved():void {
			addCommand(
			  new DoTweener( this, { y:stage.stageHeight, time:1, transition:"easeinoutsin"} ),
			  //読み込んだswfを消すために行う
			   new RemoveAllChildren(this)
			);
		}
	}
}