Packagecom.jeffdePascale.fosfr.debug
Classpublic class Debug
InheritanceDebug Inheritance flash.events.EventDispatcher

The Debug class is a visual debugging utlity for AS3. Unlike most other components of the Fosfr framework, Debug can be instantiated independently if so desired, and has no direct ties to the Fosfr framework itself.

Debug provides a number of benefits over using just trace(). Most valuable is the ability to view debugging information outside of the IDE. Calling the update() method passes a value the same way as trace. The value is sent both to the standard AS3 trace method and also to a autogenerated displayObject. Viewing the display area is controlled by specifying one or two toggle key keyCode values in the primaryKeyCode and secondaryKeyCode properties. Toggle keys may be disabled globally through the enabled parameter. Debug also provides the ability, through the display area, to pause or restart debugging, clear the output text area, copy the full debug list to the clipboard, and optionally to email the debug output to a specified set of recipients through the enableEmail method. Debug also allows for custom buttons to be added to the panel to define custom debugging actions.



Public Properties
 PropertyDefined by
  draggable : Boolean
A boolean value defining whether the Debug display area can be dragged by dragging the header of the display area.
Debug
  enabled : Boolean
a boolean value specifying whether debug update values are accepted and trace events are dispatched, enabled also controls whether the toggle keycodes are functional or disabled.
Debug
  primaryKeyCode : uint
a uint value for the keyboard keycode to toggle visiblity of the Debug panel.
Debug
  repeatTraceDelay : uint
Defines a value, in milliseconds, to ignore a debug value if it is identical to the last received value.
Debug
  secondaryKeyCode : uint
an optional second keyboard keycode to toggle visibility of the Debug panel.
Debug
Public Methods
 MethodDefined by
  
Debug(_displayObj:DisplayObject, _enabled:Boolean = true)
Creates an instance of the Debug class but does not start the Debug Panel.
Debug
  
addCustomButton(label:String, identifier:String):DebugButton
Allows for the addition of buttons to the Debug panel for adding custom functionality.
Debug
  
enableEmail(emailArray:Array):void
Optionally adds email functionality to the Debug panel for sending debug reports to the recipients specified on the emailArray parameter.
Debug
  
initialize():void
Starts the debug panel.
Debug
  
removeCustomButton(identifier:String):void
Allows for the removal of buttons from the Debug panel added via the addCustomButton method.
Debug
  
setProjectNameAndVersion(_projectName:String, _version:String = null):void
Specifies the optional string values for the SWF project name and version number that is placed both in the header of the Debug panel and in the subject line of emails dispatched.
Debug
  
setSubHeadText(text:String):void
Optionally allows for a second line of copy to appear below the project and version information in the Debug panel.
Debug
  
update(str:*):void
Adds text values to the Debug panel.
Debug
Events
 EventSummaryDefined by
   Dispatched when debug information is added to the Debug list.Debug
Property detail
draggableproperty
public var draggable:Boolean

A boolean value defining whether the Debug display area can be dragged by dragging the header of the display area. the Debug panel will always return to the upper left when retoggled.

The default value is true.

enabledproperty 
public var enabled:Boolean

a boolean value specifying whether debug update values are accepted and trace events are dispatched, enabled also controls whether the toggle keycodes are functional or disabled. This allows for complete disabling of the Debug panel in final distributions without removal of the Debug package.

The default value is true.

primaryKeyCodeproperty 
public var primaryKeyCode:uint

a uint value for the keyboard keycode to toggle visiblity of the Debug panel. The default value equates to the '~' key.

The default value is 192.

repeatTraceDelayproperty 
public var repeatTraceDelay:uint

Defines a value, in milliseconds, to ignore a debug value if it is identical to the last received value. To turn off this feature, set to 0.

The default value is 100;.

secondaryKeyCodeproperty 
public var secondaryKeyCode:uint

an optional second keyboard keycode to toggle visibility of the Debug panel. If a second keycode is specified, both the primary and secondary keys must be pressed to toggle visibility of the Debug panel. To disable the second key, set its value to 0.

The default value is 0.

Constructor detail
Debug()constructor
public function Debug(_displayObj:DisplayObject, _enabled:Boolean = true)

Creates an instance of the Debug class but does not start the Debug Panel.

Parameters
_displayObj:DisplayObject — a reference to the stage, used to create the Debug panel.
 
_enabled:Boolean (default = true) — optional; toggles the active state of the Debug panel.

See also

Method detail
addCustomButton()method
public function addCustomButton(label:String, identifier:String):DebugButton

Allows for the addition of buttons to the Debug panel for adding custom functionality. Returns an instance of the DebugButton class. Remove custom buttons with the removeCustomButton method.

Parameters
label:String — A string value to place as the label on the button.
 
identifier:String — a string value to serve as the identifer for the button.

Returns
DebugButton — an instance of the DebugButton class.

See also

enableEmail()method 
public function enableEmail(emailArray:Array):void

Optionally adds email functionality to the Debug panel for sending debug reports to the recipients specified on the emailArray parameter.

Parameters
emailArray:Array — An array of email addresses to send the debug reports to.

See also

initialize()method 
public function initialize():void

Starts the debug panel.

removeCustomButton()method 
public function removeCustomButton(identifier:String):void

Allows for the removal of buttons from the Debug panel added via the addCustomButton method. Returns an instance of the DebugButton class.

Parameters
identifier:String — The string name of the identifier specified when the button was created with the addCustomButton method.

See also

setProjectNameAndVersion()method 
public function setProjectNameAndVersion(_projectName:String, _version:String = null):void

Specifies the optional string values for the SWF project name and version number that is placed both in the header of the Debug panel and in the subject line of emails dispatched.

Parameters
_projectName:String — _projectName The name of the project.
 
_version:String (default = null) — optional; the version number of the project.

See also

setSubHeadText()method 
public function setSubHeadText(text:String):void

Optionally allows for a second line of copy to appear below the project and version information in the Debug panel.

Parameters
text:String — The copy to display in the textField.
update()method 
public function update(str:*):void

Adds text values to the Debug panel. Each call of update() adds a new line to the panel and adds the toString() equivalent of whatever is passed in the str parameter. If duplicate values are passed sequentially to the update() method within the threshold specified in repeatTraceDelay, the value is ignored.

Parameters
str:* — the value to be added to the Debug panel. Values passed are evaluated using the toString() method.

See also

Event detail
traceevent 
Event object type: com.jeffdePascale.fosfr.debug.DebugEvent
DebugEvent.type property = com.jeffdePascale.fosfr.debug.DebugEvent.TRACE

Dispatched when debug information is added to the Debug list.

The DebugEvent.TRACE constant defines the value of the type property of the event object for a trace event.

The properties of the event object have the following values:

Property Value
type "complete"
bubbles A Boolean value.
cancelable A Boolean value.
value a string value of the debug information.