Flash片头loading与MovieClipLoader

//创建侦听器,侦听是否加载完成
var loader = new MovieClipLoader();
loader.onLoadComplete = function(obj)
{
	if(obj == infostar )
	{
		isinfoLoad = true;
	}
	else if (obj == selstar)
	{
	 	ischoseLoad = true;
	}
	else if (obj == playstar)
	{
		isplayLoad = true;
	}
}

//设置加载是否完成的标记
var isinfoLoad :Boolean = false;
var ischoseLoad :Boolean= false;
var isplayLoad :Boolean  = false;

//开始加载
loadinfo();
loadchose();
loadplay();

//写个定时器,等待加载完成
var id :Number = setInterval(this, "OnTimer",10);

function OnTimer()
{
	if(!isinfoLoad) 
	{
		//trace("----OnTimer isinfoLoad--------" + isinfoLoad);
		return;
	}
	
	if(!ischoseLoad)
	{
		//trace("----OnTimer ischoseLoad--------" + isinfoLoad);
		return;
	}
	if(!isplayLoad) 
	{
		//trace("----OnTimer isplayLoad--------" + isinfoLoad);
		return;
	}

	
	clearInterval(id);
	//通知c++,进入指定的界面
	ExternalInterface.call("GFX_CSS_SetWhichPageToFadeIn");
	
}

//~~------------------------------------------------------
function loadinfo()
{
   if(!isinfoLoad)
   {    
      loader.loadClip("../PVEDekaronTarget/PVEDekaronTarget.gfx", infostar);
   }
}
//~~------------------------------------------------------
 function loadchose()
{
	 if(!ischoseLoad)
	 {
		 loader.loadClip("../PVEchosenplayer/PVEchosenplayer.gfx", selstar);
	 }
}
//~~------------------------------------------------------
 function loadplay()
{
	if(!isplayLoad)
	{
		loader.loadClip("../PVEPlayerprofile/PVEPlayerprofile.gfx", playstar);
	}	
}


posted on 2014-10-15 17:18  KHacker  阅读(156)  评论(0编辑  收藏  举报