`

AS引用其它swf

 
阅读更多
被引入的SWF必须是以下发布模式:


var my_urlloader:Loader=new Loader();
var swf_urlloader:URLLoader =new URLLoader;
swf_urlloader.dataFormat =URLLoaderDataFormat.BINARY ;

function testLoad(): void {
try {
	swf_urlloader.load(new URLRequest("testflash.swf"));
	swf_urlloader.addEventListener(Event.COMPLETE,binaryLoadComplete);
} catch (_err:Error) {
	trace(_err);
}
}

function binaryLoadComplete(_evt:Event):void {
	//swf_loader=new Loader;
	
	my_urlloader.loadBytes(_evt.target.data);
	my_urlloader.contentLoaderInfo.addEventListener(Event.COMPLETE ,swfLoadComplete);
}

function swfLoadComplete(_evt:Event):void {
	var externalSWF:MovieClip = MovieClip(_evt.currentTarget.content);
        // 调整高宽
	externalSWF.x = 100;//左上角坐标X
	externalSWF.y = 800;//左上角坐标Y
	externalSWF.width = 200;//宽度
	externalSWF.height = 100;//高度
	addChild(externalSWF);
}
  • 大小: 30.7 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics