Hello, this issue is killing me. I had a swf that loaded an xml file then
loaded images from the xml file and then killed the display list, xml,
images etc... then restarted based on a timer. Every time it reloads
however, I watch firefox take away memory consistently and when I refresh
that page memory use drops back to normal. So, I said screw this, I'm going
to create an empty swf and load the swf with all the magic in it and add it
to the empty swf. I figured if I add the swf to the main stage and kill that
one reference to the swf when I was done with it, I should have fixed my
problem. Here's my code. Can someone please tell me what is going on? 


stop();

var mLoader:Loader = new Loader();
function startLoad()
{
        var mRequest:URLRequest = new
URLRequest("hasch_flash/currently_watched_videos.swf");
        //var mRequest:URLRequest = new
URLRequest("currently_watched_videos.swf");
        mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onCompleteHandler, false, 0, true);
        mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
onProgressHandler, false, 0, true);
        mLoader.load(mRequest);
}

function onCompleteHandler(loadEvent:Event)
{
        trace("load " + loadEvent.currentTarget.content);
        trace("loadTarget " + loadEvent.target);
        addChild(loadEvent.currentTarget.content);
}
function onProgressHandler(mProgress:ProgressEvent)
{
        var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
        trace(percent);
}
startLoad();


TimerExample();

// Set off timer to kill carousel and restart movie
function TimerExample() {
        var myTimer:Timer = new Timer(30000, 0);
        myTimer.addEventListener("timer", timerHandler);
        myTimer.start();
}

function timerHandler(event:TimerEvent):void {
        trace(this.removeChildAt(0)); // remove from display list
        mLoader = null;
        mLoader =  new Loader(); // clear from memory
        startLoad();
        trace("timerHandler: " + event);
}


Thanks for any advice. T

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to