Re-using Loader to load more then 1 movieclip dynamically
Hi,
I want to create a very simple movie which has a stage of 800x400.
On that movie I have 1 movieclip called "flashClip" and 2 buttons named "myButton1" and "myButton2"
I want my movie to load the external file eekhoorn.swf into my movieclip when I press "myButton1" and eekhoorn2.swf when I press "myButton2".
And the code below also WORKS !
myButton1.addEventListener(MouseEvent.CLICK,button 1Pressed);
myButton2.addEventListener(MouseEvent.CLICK,button 2Pressed);
var loader:Loader = new Loader();
flashClip.addChild(loader);
function button1Pressed(evt:Event) {
loader.load(new URLRequest('eekhoorn.swf'));
}
function button2Pressed(evt:Event) {
loader.load(new URLRequest('eekhoorn2.swf'));
}
But, I only want 1 of the 2 flash movies to play inside of my movieclip container. If you now press myButton1 , wait 5 seconds and press myButton2, then I can clearly hear that both eekhoorn.swf and eekhoorn2.swf are playing, while in fact only the last one clicked should play.
It looks like my loader object loads EXTRA data when you click, but it also keeps the old data which was still in it.
Eekhoorn.swf is around 3Mb here on my harddrive, and I allready tried clicking 100 times on the buttons and really saw my memory usage grow by 300Mb.
Is there a nice way to be able to load different swf files into a movieclip one after the other (so not together) ?
Kind regards,
Thanks for any help,
Bart