He guys,
I got this code, where Im loading external swf onClick of a btn. but now I noticed that they don’t unload when i go to a other page, and that will eat alot of memory. Plus that when I play a movie in a page, and go to an other page, you’ll will hear the movie keep on playing when it isnt there anymore
part of the code:
import flash.display.Loader;
import flash.net.URLRequest;
import fl.transitions.Tween;
import fl.transitions.easing.*;
//use the Loader class
var i =new Loader();
addChild(i)
//enter the path and name of your object to load
i.load(new URLRequest("swf/about.swf"));
btn1.addEventListener(MouseEvent.CLICK, onClick);
btn2.addEventListener(MouseEvent.CLICK, onClick);
btn3.addEventListener(MouseEvent.CLICK, onClick);
btn4.addEventListener(MouseEvent.CLICK, onClick);
btn5.addEventListener(MouseEvent.CLICK, onClick);
//Handmode cursor ON!!
btn1.buttonMode = true;
btn2.buttonMode = true;
btn3.buttonMode = true;
btn4.buttonMode = true;
btn5.buttonMode = true;
//Navigatie Links, Load on click..?
var dict:Dictionary = new Dictionary()
dict[btn1] = "swf/about.swf"
dict[btn2] = "swf/products.swf"
dict[btn3] = "swf/visuals.swf"
dict[btn4] = "swf/referenties.swf"
dict[btn5] = "swf/contact.swf"
var myLoader:Loader = new Loader();
addChild(myLoader);
//FUNCTION MOUSE EVENTES!!
function onClick(event:MouseEvent):void
{
myLoader.load(new URLRequest(dict[event.target]));
}
How do I apply the unloader/removeChild to this code? and how does it work?
I would appreciate if someone can help me out with this issue.
thanks,
rieko