/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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); }