Thursday, May 17, 2012

[Action Script] Problem clearing phones memory for Flashlite May,2012

Hi everyone,

I've been trying to make a program that randomly plays interactive SWFs for my mobile phone (Flashlite).

You can click on one of the random SWFs and it plays then goes back to another SWF that loads a second one. This works fine for about 4 or 5 times, afterwhich it stops working.

I am guessing that the memory is getting clogged up. Could someone explain how to clear the phones memory after the SWF has finished?

Here is the script I'm using for the main file that randomly loads SWF files:

ActionScript Code: stop ();var movieArray:Array = ['template','words ~002','words ~003'];var loader:Loader = new Loader(); var index:int = movieArray.length * Math.random();var url:String = movieArray[index] + '.swf';movieArray.splice(index, 1); // this will remove that item from the arraytrace("Attempting to load", url);  loader.load(new URLRequest(url));  loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderComplete);loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderIOError);addChild(loader);function loaderComplete(e:Event):void {              trace("Successfully loaded", url);}function loaderIOError(e:IOErrorEvent):void {               trace("Failed to load", url);}

Here is the script I'm using at the end of the random SWF files (to send it back to the main SWF):

ActionScript Code: var fl_ToLoad_3:Boolean = true;function fl_ClickToLoadUnloadSWF_3(event:MouseEvent):void{    if(fl_ToLoad_3)    {        fl_Loader_3 = new Loader();        fl_Loader_3.load(new URLRequest("greetings.swf"));        addChild(fl_Loader_3);    }    else    {        fl_Loader_3.unload();        removeChild(fl_Loader_3);        fl_Loader_3 = null;    }    // Toggle whether you want to load or unload the SWF    fl_ToLoad_3 = !fl_ToLoad_3;}


Any help would be really appreciated!!!
Problem clearing phones memory for Flashlite

Related Post



0 comments: