• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

remove external swf completely from memory

Community Beginner ,
Dec 10, 2011 Dec 10, 2011

Copy link to clipboard

Copied

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;

}

TOPICS
ActionScript

Views

2.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 10, 2011 Dec 10, 2011

Copy link to clipboard

Copied

:

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;

}

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 10, 2011 Dec 10, 2011

Copy link to clipboard

Copied

Thank you very much.

My swf is a movieclip that make only a fade and stop, then load an still image that you can drag, zoom, etc.

Do you think do I have to stop all streams....?

If yes, how can I do it?

what mean ...fp 10+ ...

many thanks again.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 10, 2011 Dec 10, 2011

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 11, 2011 Dec 11, 2011

Copy link to clipboard

Copied

Thank you very much.

I have a last question.

In my external swf I have put a close button with this code:

btclose.addEventListener(MouseEvent.CLICK, CloseMe);

function CloseMe(event:MouseEvent) {

    MovieClip(parent.parent).removeMe(event);

}

stop();

In the main movie i have te removeMe function that works perfectly when I close from the main, but not with the close buton of external swf, it seem does not access to the removeMe function, what is wrong here?

function removeMe(e:Event):void

{

    if (oneLoader)

    {

        oneLoader.unloadAndStop();

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

        oneLoader.parent.removeChild(oneLoader);

        oneLoader.unload(); //    ..... I added, I'm use fp 11.

        oneLoader= null;

     }

   }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 11, 2011 Dec 11, 2011

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 11, 2011 Dec 11, 2011

Copy link to clipboard

Copied

Thank you again.

The code are on their right places.

But When I close with the swf button close. The window is closed but not remove from memory.

I have other button on the main movie (for try)  and when I push this: close the swf and remove form memory.

Do you know why I cannot remove from the swf button?

thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 11, 2011 Dec 11, 2011

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines