| Package | com.jeffdePascale.fosfr.debug |
| Class | public class Debug |
| Inheritance | Debug flash.events.EventDispatcher |
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.
| Property | Defined 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 | ||
| Method | Defined 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 | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when debug information is added to the Debug list. | Debug | |||
| draggable | property |
public var draggable:BooleanA 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.
| enabled | property |
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.
| primaryKeyCode | property |
public var primaryKeyCode:uinta 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.
| repeatTraceDelay | property |
public var repeatTraceDelay:uintDefines 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;.
| secondaryKeyCode | property |
public var secondaryKeyCode:uintan 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.
| Debug | () | constructor |
public function Debug(_displayObj:DisplayObject, _enabled:Boolean = true)
Creates an instance of the Debug class but does not start the Debug Panel.
_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
| 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.
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.
|
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.
emailArray:Array — An array of email addresses to send the debug reports to.
|
See also
| initialize | () | method |
public function initialize():voidStarts 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.
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):voidSpecifies 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):voidOptionally allows for a second line of copy to appear below the project and version information in the Debug panel.
Parameterstext: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.
str:* — the value to be added to the Debug panel. Values passed are evaluated using the toString() method.
|
See also
| trace | event |
com.jeffdePascale.fosfr.debug.DebugEvent
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. |