ActionScript 3 从外部swf调用函数

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 从外部swf调用函数相关的知识,希望对你有一定的参考价值。

//This creates a new instance of the loader object.
var my_Loader:Loader = new Loader();

var my_loadedSwf:MovieClip;

//These listeners detect when the file has finished loading, and if the correct file is 
//loaded.
my_Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishLoading);
my_Loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);

//The load method then loads the SWF file into the loader object.
my_Loader.load(new URLRequest("mouseover2.swf"));

//This assigns the loaded SWF into a variable which allows the testing() function to be called.
function finishLoading(loadEvent:Event) {
my_loadedSwf = loadEvent.currentTarget.content;

addChild(my_loadedSwf);

my_loadedSwf.testing();
}

function errorHandler(errorEvent:Event):void {
trace("file not found");
}

以上是关于ActionScript 3 从外部swf调用函数的主要内容,如果未能解决你的问题,请参考以下文章