Skip to content

Commit

Permalink
update monitor tool to listen to timer event instead of mouse event
Browse files Browse the repository at this point in the history
  • Loading branch information
Elad Elrom authored and Elad Elrom committed Jul 23, 2010
1 parent 667ccee commit d9a929e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
Binary file modified bin-debug/BitmapCachingExample.swf
Binary file not shown.
Binary file modified bin-debug/FrameRateControlExample.swf
Binary file not shown.
Binary file modified bin-debug/OptimazingTools.swf
Binary file not shown.
26 changes: 18 additions & 8 deletions src/OptimazingTools.mxml
Expand Up @@ -12,26 +12,33 @@
import flash.sampler.getSize;
import mx.controls.Text;
import mx.core.FlexGlobals;
import mx.core.UIComponent;
import spark.components.Button;
import spark.components.RichText;
import spark.components.supportClasses.Skin;
import tests.*;
private var frameRateControl:FrameRateControl;
private var frameStats:FrameStats;
private var sprite:Sprite = new Sprite();
protected function creationCompleteHandler():void
{
frameStats = new FrameStats(FlexGlobals.topLevelApplication, true );
frameStats = new FrameStats(FlexGlobals.topLevelApplication, false );
frameRateControl = new FrameRateControl( FlexGlobals.topLevelApplication, false, false, 1, 1);
var componenent:UIComponent = new UIComponent();
componenent.addChild( frameStats );
frameStatsHolder.addElement( componenent );
//this.addEventListener(Event.ENTER_FRAME, onAddToStage );
this.addEventListener(Event.ENTER_FRAME, onEnterFrame );
uicom.addChild( sprite );
}
protected function button1_clickHandler():void
Expand All @@ -46,18 +53,20 @@
}
private var counter:int = 0;
private function onAddToStage(event:Event):void
private function onEnterFrame(event:Event):void
{
if (++counter == 5)
if (++counter == 15)
{
frameStats.isDebugMode = true;
trace("********* add to stage START *********");
for (var i:int=0; i<100; i++)
this.addElement( new UIComponent() );
for (var i:int=0; i<1000; i++)
this.addElement( new RichText() );
}
if (counter == 6)
if (counter == 16)
{
this.removeEventListener(Event.ENTER_FRAME, onAddToStage );
frameStats.isDebugMode = false;
this.removeEventListener(Event.ENTER_FRAME, onEnterFrame );
trace("********* add to stage END *********");
}
}
Expand All @@ -66,5 +75,6 @@
</fx:Script>

<s:Group id="frameStatsHolder" />
<mx:UIComponent id="uicom" />

</s:Application>
2 changes: 1 addition & 1 deletion src/com/elad/optimize/memory/FrameStats.as
Expand Up @@ -45,7 +45,7 @@ package com.elad.optimize.memory
private static var HEIGHT:int = 100;

private var isShowCounters:Boolean;
private var isDebugMode:Boolean;
public var isDebugMode:Boolean;
private var isForceInvalidateAndUpdateAfterEvent:Boolean;
private var countSecondsSinceStart:int = 0;

Expand Down

0 comments on commit d9a929e

Please sign in to comment.