/ Published in: ActionScript 3
Hi;
This is part of my new framework, the class is called Stats and is very simple stat util, click the black background to get more info, click the circle to garbage collect. It always get's on the top of the stage display list
The Grawl graphics are drawn by Bassta Draw API
demo: http://burnandbass.com/stats-bab/
This is part of my new framework, the class is called Stats and is very simple stat util, click the black background to get more info, click the circle to garbage collect. It always get's on the top of the stage display list
The Grawl graphics are drawn by Bassta Draw API
demo: http://burnandbass.com/stats-bab/
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package bassta.debug { import bassta.structure.Initializer; import bassta.display.BTextField; import bassta.display.BSprite; import bassta.debug.Grawl; import bassta.debug.MemoryFPS; import flash.display.Stage; import flash.events.Event; import flash.events.MouseEvent; import flash.system.System; public class Stats extends BSprite{ public function Stats() { } public static function create():void{ var bg:BSprite = BSprite.newRect({color:"black", width:135, height:20, round:10}, {x:5, y:5, alpha:0.5, cacheAsBitmap:true, mouseChildren:true}); var mem:MemoryFPS = new MemoryFPS().autoStart().attrs({x:3, y:3}); var circle:BSprite = BSprite.newCircle({radius:5, color:"white"}, {x:120, y:10, cacheAsBitmap:true, buttonMode:true}); bg.addChildren(mem, circle); bg.addEventListener(MouseEvent.ROLL_OVER, function():void{ bg.tween({time:0.5, alpha:1}); }); bg.addEventListener(MouseEvent.ROLL_OUT, function():void{ bg.tween({time:0.5, alpha:0.5}); }); mem.addEventListener(MouseEvent.CLICK, function():void{ Grawl.info( "[Stage] width: " + Initializer.stageWidth + " ; height: " + Initializer.stageHeight + "\n" + "[Memory] " + mem.currentMemory + "MB; Maximum: " + mem.memoryPeak + " MB; Free: " + mem.freeMemory + "\n" + "[FPS] " + mem.FPS + " ; Averege: " + mem.averegeFPS + " ; RunTime: " + mem.runtime + " seconds" ); }); circle.addEventListener(MouseEvent.CLICK, function():void{ System.gc(); Grawl.show("[System ] Garbage Collected!"); }); Initializer.instance.stage.addChild(bg); Initializer.instance.stage.addEventListener(Event.ADDED, function():void{ bg.sendFront(); //sets the Stats on the top of stage display list }); }//end create() }//end package/class }
URL: http://burnandbass.com/stats-bab/