Loading/Unloading external SWF using buttons from loaded external files

1k views Asked by At

I spent almost a week trying to figure out how to unload a currently loaded swf using its button and loading a new swf...

I have three files, a main.fla, file1.fla and file2.fla. In my main.fla, I have a code which loads the other two files. If i will click the "unload" button in the file1.swf, I would like the main.fla to unload the file1.swf and load the other file, file2.swf.

Here is the code to load the file1.swf:

stop();

var Xpos:Number=131;
var Ypos:Number=115.1;
var swf:MovieClip;
var loader:Loader=new Loader();

var newSWFRequest:URLRequest=new URLRequest("file1.swf")
loader.load(newSWFRequest);
loader.x=Xpos;
loader.y=Ypos; 
addChild(loader);

Thanks in anticipation... Your help would be much appreciated..

1

There are 1 answers

0
TNC On

You can do something like:

MovieClip(parent.parent).functionName();

Here is a good tutorial to explain the workings: http://flexcomps.wordpress.com/2008/09/01/as3-calling-myfunction-on-main-timeline-from-loaded-swf/