加载外部影片A、B

var loader1:Loader =new Loader();
var loader2:Loader =new Loader();
var dz1:URLRequest = new URLRequest("a.swf");
var dz2:URLRequest = new URLRequest("b.swf");
//Abtn,Bbtn为按钮
Abtn.addEventListener(MouseEvent.CLICK,cd1);
Bbtn.addEventListener(MouseEvent.CLICK,cd2);
function cd1(e:MouseEvent):void
{
	//加载a.swf
	loader1.load(dz1);
	addChild(loader1);
	//判断加载有b.swf就干掉
	if (loader2.content)
	{
		loader2.unloadAndStop(true);
	}
}
function cd2(e:MouseEvent):void
{
	//加载b.swf
	loader2.load(dz2);
	addChild(loader2);
	//判断有a.swf就干掉
	if (loader1.content)
	{
		loader1.unloadAndStop(true);
	}
}
posted on 2011-03-20 18:24  602147629  阅读(282)  评论(0编辑  收藏  举报