Return to Snippet

Revision: 56766
at April 15, 2012 07:02 by tuffstudio


Initial Code
//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");
}

Initial URL

                                

Initial Description
code below assumes you have method testing() in external swf.

Initial Title
call a function from external swf

Initial Tags

                                

Initial Language
ActionScript 3