Skip to main content
August 31, 2010
Question

removeChild not doing anything

  • August 31, 2010
  • 1 reply
  • 515 views

Hi All

I'm using an onEnterFrame handler to load an external swf file which works fine at frame 190...

var fl_Loader:Loader;
addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler);

function fl_EnterFrameHandler(event:Event):void
{
        fl_Loader = new Loader();
        fl_Loader.load(new URLRequest("authorisedDealerSlide.swf"));
        addChild(fl_Loader);

}

However, I can't seem to get the swf file to unload at frame 215...

  addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler2);

    

         function fl_EnterFrameHandler2(event:Event):void
{
         removeChild(fl_Loader);

}

Is there a scoping issue here or something else? I've tried several different ways to get rid of it but no joy.

It's been a long time since I used AS!

Thanks for any help

This topic has been closed for replies.

1 reply

August 31, 2010

Hi

If you're using different keyframes, the

var fl_Loader:Loader;

isn't visible/known on later frames..

Define it as:

_global var fl_Loader:Loader;

and you can use it anywhere on the timeline.

Normally I would recommend to unload an object

before leaving the current keyframe..

If the above doesn't work, please show the error.

Best regards

Peter

August 31, 2010

Thanks for the suggestion.

Still no joy. Although, no error is shown - it just doesn't do anything...

I'm unloading at a later point so as to transition between other content. May not be the best approach but was hoping to keep download times to a minimum.