PDA

View Full Version : Load and Unload SWF



LauraITT
March 30th, 2008, 05:21 PM
Hey,

This is the code I have so far, it opens the BonesInsideCastle.swf but it doesnt unload the first swf .... Any idea's ??


stop();
Castle.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
function mouseDown(event:MouseEvent):void {
if (event.target == Castle) {

var myrequest:URLRequest=new URLRequest("BonesInsideCastle.swf");
var myloader:Loader=new Loader();
myloader.load(myrequest);
stage.addChild(myloader); } }// and the unloadFunction function

var myloader:Loader=new Loader();
myloader.unload();
myloader.addEventListener("Unloadme", unloadFunction);
function unloadFunction(event:Event):void {
// event.target is the loader reference.. so cast it as Loader
Loader(event.currentTarget).unload(); }

Thanks in advance

icio
March 31st, 2008, 12:23 PM
Are you trying to remove it from the stage? Look into the `removeChild` function.