Packagecom.demonsters.debugger
Classpublic class MonsterDebugger
InheritanceMonsterDebugger Inheritance Object

The Monster Debugger main class



Public Properties
 PropertyDefined By
  enabled : Boolean
[static] Enables or disables the Monster Debugger.
MonsterDebugger
  logger : Function
[static] Debugger for the Monster Debugger.
MonsterDebugger
Public Methods
 MethodDefined By
  
breakpoint(caller:*, id:String = breakpoint):void
[static] Since version 3.0 the Monster Debugger supports breakpoints.
MonsterDebugger
  
clear():void
[static] This will clear all traces in the connected Monster Debugger desktop application.
MonsterDebugger
  
initialize(base:Object, address:String = 127.0.0.1):void
[static] This will initialize the Monster Debugger, the client will start a socket connection to the Monster Debugger desktop application and initialize the core functions like memory- and fpsmonitor.
MonsterDebugger
  
inspect(object:*):void
[static] This function will change the base target of the Monster Debugger that was set in the initialize function and send the new target to the desktop application for inspection.
MonsterDebugger
  
log(... args):void
[static] This is a copy of the classic Flash trace function where you can supply a comma separated list of objects to trace.
MonsterDebugger
  
snapshot(caller:*, object:DisplayObject, person:String, label:String):void
[static] Makes a snapshot of a DisplayObject and sends it to the desktop application.
MonsterDebugger
  
trace(caller:*, object:*, person:String, label:String, color:uint = 0x000000, depth:int = 5):void
[static] The trace function of the Monster Debugger can be used to display standard objects like Strings, Numbers, Arrays, etc.
MonsterDebugger
Public Constants
 ConstantDefined By
  VERSION : Number = 3.02
[static]
MonsterDebugger
Property Detail
enabledproperty
enabled:Boolean

Enables or disables the Monster Debugger. You can set this property before calling initialize to disable even the core functions and socket connection to keep the memory footprint at a minimum. We advise you to always disable the Monster Debugger on a final build.


Implementation
    public static function get enabled():Boolean
    public static function set enabled(value:Boolean):void
loggerproperty 
public static var logger:Function

Debugger for the Monster Debugger.


Example
MonsterDebugger.initialize(this); MonsterDebugger.logger = trace; MonsterDebugger.logger(["foo", "bar"]);
Method Detail
breakpoint()method
public static function breakpoint(caller:*, id:String = breakpoint):void

Since version 3.0 the Monster Debugger supports breakpoints. Calling this function will pause your application on that specific point. All timers, event listeners, animations, etc. will stop, but you can still inspect your application using the Monster Debugger desktop application. Note: This function is only available when running your application in the Flash Debug Player or Adobe AIR’s ADL launcher.

Parameters

caller:* — The caller of the breakpoint. We suggest you always use the keyword "this". The caller is displayed in the desktop application to easily identify your breakpoints on instance level. Note: if you use this function within a static class use a string as caller like: "MyStaticClass".
 
id:String (default = breakpoint) — (Optional) The identifier of the breakpoint, used as a label in the interface.


Example
MonsterDebugger.breakpoint(this); MonsterDebugger.breakpoint(this, "myLabel");
clear()method 
public static function clear():void

This will clear all traces in the connected Monster Debugger desktop application.


Example
MonsterDebugger.clear();
initialize()method 
public static function initialize(base:Object, address:String = 127.0.0.1):void

This will initialize the Monster Debugger, the client will start a socket connection to the Monster Debugger desktop application and initialize the core functions like memory- and fpsmonitor. From this point on you can use other functions like trace, snapshot, inspect, etc.

Parameters

base:Object — The root of your application. We suggest you use the document class or stage property for this. In PureMVC projects this could also be your main view or application façade, but in this you won't be able to see the display tree or use the highlight functions.
 
address:String (default = 127.0.0.1) — (Optional) An IP address where the Monster Debugger will try to connect to. By default it will connect to you local IP address (127.0.0.1) but you can also supply another IP address like a remote machine.


Example
MonsterDebugger.initialize(this); MonsterDebugger.initialize(stage);
inspect()method 
public static function inspect(object:*):void

This function will change the base target of the Monster Debugger that was set in the initialize function and send the new target to the desktop application for inspection. For example: This can be easy when you want to inspect a loaded SWF movie or an active window in case of Adobe AIR. The main advantage of inspect over a trace if the live browsing capabilities in the desktop application and the possibility to adjust properties and run methods.

Parameters

object:* — The object to inspect.


Example
MonsterDebugger.inspect(myMovieClip); MonsterDebugger.inspect(NativeApplication.activeWindow);
log()method 
public static function log(... args):void

This is a copy of the classic Flash trace function where you can supply a comma separated list of objects to trace. It will call the MonsterDebugger.trace() function for every object you supply in the arguments (... args). This can be useful when tracing multiple properties at once like: MonsterDebugger.log(x, y, width, height). But it can also be handy for tracing events as can be seen in the example.

Parameters

... args — A list of objects or properties to trace.


Example
MonsterDebugger.log(x, y, width, height); addEventListener(Event.COMPLETE, MonsterDebugger.log); addEventListener(MouseEvent.CLICK, MonsterDebugger.log);
snapshot()method 
public static function snapshot(caller:*, object:DisplayObject, person:String, label:String):void

Makes a snapshot of a DisplayObject and sends it to the desktop application. This can be useful if you need to compare visual states or display a hidden interface item. Snapshot will return an un-rotated, completely visible (100% alpha) representation of the supplied DisplayObject.

Parameters

caller:* — The caller of the snapshot. We suggest you always use the keyword "this". The caller is displayed in the desktop application to easily identify your snapshots on instance level. Note: if you use this function within a static class use a string as caller like: "MyStaticClass".
 
object:DisplayObject — The object to create the snapshot from. This object should extend a DisplayObject (like a Sprite, MovieClip or UIComponent).
 
person:String — (Optional) The person of interest. You can use this label to easily work with a team of programmers on one project. The desktop application has a filter for persons so each member can see their own snapshots.
 
label:String — (Optional) Label to identify the snapshot. Within the desktop application you can filter on this label.


Example
MonsterDebugger.snapshot(this, myMovieClip); MonsterDebugger.snapshot(this, myBitmap, "joe", "interface");
trace()method 
public static function trace(caller:*, object:*, person:String, label:String, color:uint = 0x000000, depth:int = 5):void

The trace function of the Monster Debugger can be used to display standard objects like Strings, Numbers, Arrays, etc. But it can also be used to display more complex objects like custom classes, XML or even multidimensional arrays containing XML nodes for that matter. It will send a snapshot of those objects to the desktop application where you can inspect them.

Parameters

caller:* — The caller of the trace. We suggest you always use the keyword "this". The caller is displayed in the desktop application to easily identify your traces on instance level. Note: if you use this function within a static class, use a string as caller like: "MyStaticClass".
 
object:* — The object to trace, this can be anything. For instance a String, Number or Array but also complex items like a custom class, multidimensional arrays.
 
person:String — (Optional) The person of interest. You can use this label to easily work with a team of programmers on one project. The desktop application has a filter for persons so each member can see their own traces.
 
label:String — (Optional) Label to identify the trace. Within the desktop application you can filter on this label.
 
color:uint (default = 0x000000) — (Optional) The color of the trace. This can be useful if you want to color code your traces; red for errors, green for status updates, etc.
 
depth:int (default = 5) — (Optional) The level of depth for this trace. By default the Monster Debugger will trace a tree structure of five levels deep to preserve CPU power. In some occasions 5 could not be enough to see the whole object, for instance if you’re tracing a large XML document with many sub nodes. In those situations you can use a higher number to see the complete object. If you set the depth to -1 it will not limit the levels at all and will trace the entire tree. Be careful with this setting though as it can dramatically slow down your application.


Example
MonsterDebugger.trace(this, "error"); MonsterDebugger.trace(this, myObject); MonsterDebugger.trace(this, myObject, "joe", "myLabel"); MonsterDebugger.trace(this, myObject, "joe", "myLabel", 0xFF0000, 5, true); MonsterDebugger.trace("myStaticClass", myObject);
Constant Detail
VERSIONConstant
public static const VERSION:Number = 3.02