Skip navigation
Currently Being Moderated

remove external swf completely from memory

Dec 10, 2011 8:27 AM

Hello:

 

I have read many many post and I don't find the answer of how to remove completely a swf load external.

Every time I load and unload I see the windows memory task manager and see that the memory increase and don't reduce when remove child.

¿Can you help me please?  thank you.

 

this is my code:

 

var oneLoader=new Loader();

bt1.addEventListener(MouseEvent.CLICK, swf1);

bt2.addEventListener(MouseEvent.CLICK, removeMe);

 

function swf1(e:Event)

{

 

var oneLoader=new Loader();

addChildAt(oneLoader,1);

oneLoader.load(new URLRequest("swf1.swf"));

}

function removeMe(e:Event)

{

 

removeChildAt(1);

oneLoader= null;

 

}

 
Replies
  • kglad
    72,260 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 10, 2011 8:35 AM   in reply to anjemalo

    :

     

    var oneLoader=new Loader();

    bt1.addEventListener(MouseEvent.CLICK, swf1);

    bt2.addEventListener(MouseEvent.CLICK, removeMe);

     

    function swf1(e:Event)

    {

     

    var oneLoader=new Loader();

    addChildAt(oneLoader,1);

    oneLoader.load(new URLRequest("swf1.swf"));

    }

    function removeMe(e:Event)

    {

    if(oneLoader){

    oneLoader.unloadAndStop();  // if publishing for fp 10+, else must explicitly stop all streams and apply unload().

    oneLoader.parent.removeChild(oneLoader);

    oneLoader= null;

    }

    }

     
    |
    Mark as:
  • kglad
    72,260 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 10, 2011 3:38 PM   in reply to anjemalo

    fp 10+ =  flash player 10 or better.

     

    you don't have any streams to stop.  so, if you're publishing for fp 9, you can use oneLoader.unload();

     

    p.s.  please mark helpful/correct responses.

     
    |
    Mark as:
  • kglad
    72,260 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 11, 2011 7:50 AM   in reply to anjemalo

    1.  your external swf code needs to be on that swf's main timeline and

     

    2.  your removeMe() function needs to be on the timeline where oneLoader is created.

     
    |
    Mark as:
  • kglad
    72,260 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 11, 2011 4:34 PM   in reply to anjemalo

    it makes no difference what's calling removeMe() so you must be doing something wrong or erroneously judging the swf is not removed from memory.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points