/ Published in: ActionScript 3
See how much RAM your SWF is using.
Alternatively, use Mr.doob's Stats.
http://code.google.com/p/mrdoob/wiki/stats
Alternatively, use Mr.doob's Stats.
http://code.google.com/p/mrdoob/wiki/stats
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package { import flash.display.Sprite; import flash.text.TextField; import flash.events.TimerEvent; import flash.utils.Timer; import flash.system.System; public class MemoryMonitor extends Sprite { private var memory_tf:TextField; private var myTimer:Timer; private var currMemory:Number; public function MemoryMonitor():void { memory_tf = new TextField(); memory_tf.border = true; memory_tf.width = 100; memory_tf.height = 20; currMemory = System.totalMemory; myTimer = new Timer(0,0); myTimer.addEventListener(TimerEvent.TIMER, timerHandler); addChild(memory_tf); } public function start(interval:Number):void { myTimer.delay = interval; myTimer.start(); } public function stop():void { myTimer.stop(); } public function get currentMemory():Number { return currMemory; } private function timerHandler(evt:TimerEvent):void { currMemory = System.totalMemory; memory_tf.text = String((currMemory * 0.000000954).toFixed(3)) + " kb"; } } } // USAGE EXAMPLE ... // var myMemMon = new MemoryMonitor(); // addChild(myMemMon); // myMemMon.start(2000);
URL: http://labs.adobe.com/downloads/flashplayer10.html