Hello, I'm new to Greensock and it's products loving the ease of use and many of the futures the native classes just do not provide, or complicate, but i'm running into an issue...
I'm developing an application that continuously loads and unloads swf's. The internal swf's aren't much other than each one seperately loads a different xml file full of content and presents it on the stage. I've been running into issues of memory leaks, and my application running slow and ultimately coming to a complete stop after running for a long period of time. That is why i decided to go to loaderMax.
Well here's my issue, i have it running fine, but the memory is still climbing even with the new additions of loaderMax. Actually it seems to be climbing at a higher rate than it did prior to using Loader Max. I'm wondering if i'm doing something incorrect, or if there's something that i've just missed.
Here is a snippet of the code that loads the swf's
function zoomIn():void
{
TweenLite.killTweensOf(slideArray[randomSqareNum]);
randomSqareNum = Math.floor(Math.random() * 100 / 2);
setChildIndex(slideArray[randomSqareNum], numChildren - 1);
setChildIndex(curWeather_mc, numChildren - 1);
setChildIndex(bottomContent.content, numChildren - 1);
setChildIndex(weatherVid, numChildren - 1);
sqrOriginalX = slideArray[randomSqareNum].x;
sqrOriginalY = slideArray[randomSqareNum].y;
TweenLite.to(slideArray[randomSqareNum], .75, {y:720 / 2-60, x:1152 / 2, scaleX:12.5, scaleY:5.2, ease:Circ.easeInOut, delay:.5,onComplete:loadSlideData, autoDispose:true});
}
function loadSlideData():void
{
TweenLite.killTweensOf(slideArray[randomSqareNum]);
curSlide = new SWFLoader("Slides/"+ slideXML.image[slideInt].@file, {x:(1150-1000)/2, y:(700-460)/2 - 30, onComplete:DisplaySlide});
curSlide.load(true);
addChild(curSlide.content);
}
function DisplaySlide(event:Event):void
{
TweenLite.killTweensOf(slideArray[randomSqareNum]);
slideLength.delay = slideXML.image[slideInt].timeDelay.@seconds*1000;
slideLength.start();
setChildIndex(curWeather_mc, numChildren - 1);
setChildIndex(bottomContent.content, numChildren - 1);
setChildIndex(weatherVid, numChildren - 1);
slideLength.addEventListener(TimerEvent.TIMER, zoomOut,false,0,true);
}
function zoomOut(event:TimerEvent):void
{
slideLength.removeEventListener(TimerEvent.TIMER, zoomOut);
if(slideInt == slideXML.image.length()-1)
{
slideInt=0;
}else{
slideInt++;
}
slideLength.stop();
TweenLite.to(slideArray[randomSqareNum], .75, {y:sqrOriginalY, x:sqrOriginalX, scaleX:1, scaleY:1, ease:Circ.easeInOut,onComplete:zoomIn});
removeChild(curSlide.content);
curSlide.unload();
curSlide.dispose(true);
}
I tried doing some tracing on the loader that is being unloaded, and it states "SWFLoader 'loader1' (Myslide)", then "SWFLoader 'loader2' (Myslide)". I'm wondering if each time it's loading if it's creating a new loader every time and not fully unloading the previous. Any help will be greatly appreciated. Also let me know if you have any questions.