/ Published in: ActionScript 3
                    
                                        
The code below assume you have a method in your external SWF called testing().
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
//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");
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                