Return to Snippet

Revision: 35437
at November 8, 2010 14:37 by jaredyeo


Initial Code
import flash.display.Loader;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.system.ApplicationDomain;
import flash.system.LoaderContext;
import flash.system.System;
import flash.net.LocalConnection;

var t : Timer = new Timer(500);
var l : Loader = new Loader();

var lc : LoaderContext = new LoaderContext();
lc.applicationDomain = new ApplicationDomain();

t.addEventListener(TimerEvent.TIMER, fOnTimer);
t.start();
addChild(l);

function fOnTimer(e : TimerEvent) : void
{
	if (l.content != null)
	{
		l.unloadAndStop();
		System.gc();
		System.gc();
		try {
		new LocalConnection().connect('gc');
		new LocalConnection().connect('gc');
		} catch (e:*) {}
	}
	else
		l.load(new URLRequest("Lighthouse.jpg"), lc);
}

Initial URL
http://simplistika.com

Initial Description


Initial Title
AS3 Loader Garbage Collection

Initial Tags


Initial Language
ActionScript 3