Adobe Air iOS - Unload Swf

0

I wonder if it is possible to make unload of a swf in 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 it does the Load of swf, but does not unload of its swf , nor even calling the garbage collector it cleans. Is there any efficient way to wipe swf in memory?

    
asked by anonymous 21.10.2015 / 16:05

1 answer

0

Make sure all references to this loaded object have been set to "null", ie loading loads you enter the object inside a variable, for example.

var swf:MovieClip = myLoader.content as Movieclip; 

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

swf = null;
myLoader.unloadAndStop(true);

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

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

This my other answer can help you.

    
22.10.2015 / 18:40