加载外部影片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);

	}

}

你可能感兴趣的:(加载)