Adobe Air iOS - Unload Swf

Asked

Viewed 60 times

0

I wonder if it’s possible to do unload of a swf on iOS. I am currently doing an iOS project using Adobe Air and my class is as follows::

function foo()
{

var m_lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);

CustomUrl = new URLRequest(swfName.swf");

myLoader.load(CustomUrl,m_lc);

}

function unloadSWF(){
myLoader.unloadAndStop();
}

On the console he does the Load swf, but does not unload of their respective swf, not even calling the garbage collector it cleans. Is there any efficient way to clean the swf in remembrance?

1 answer

0

Make sure that all references of this loaded object have been set to "null", that is, when loading you enter the object within a variable, for example.

var swf:MovieClip = myLoader.content as Movieclip; 

And as soon as you perform the method unload() or unloadAndStop(), you set this variable to null. If you use the second method, set the parameter gc as true.

swf = null;
myLoader.unloadAndStop(true);

It is important also you remove the object from the stage if you have added it and the listeners of events and the like.

Do the same for any other variable that is referencing the loaded object. When doing this, run the code System.gc(); to "force" the garbage collector execution.

This my other answer can help you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.