Specifications
233ADOBE FLEX 3
Building and Deploying Adobe Flex 3 Applications
<mx:Script><![CDATA[
private function traceEvent(event:Event):void {
trace(event.currentTarget + ":" + event.type);
}
]]></mx:Script>
<mx:Button id="b1" label="Click Me"
preinitialize="traceEvent(event)"
initialize="traceEvent(event)"
creationComplete="traceEvent(event)"
updateComplete="traceEvent(event)"
/>
</mx:Application>
The following example shows the output of this simple application:
TraceLifecycle_3.b1:Button:preinitialize
TraceLifecycle_3.b1:Button:initialize
TraceLifecycle_3.b1:Button:creationComplete
TraceLifecycle_3.b1:Button:updateComplete
TraceLifecycle_3.b1:Button:updateComplete
TraceLifecycle_3.b1:Button:updateComplete
Messages that you log by using the trace() method should be Strings. If the output is not a String, use the
String(...) String conversion function, or use the object’s toString() method, if one is available, before you
call the
trace() method.
To enable tracing, you must configure the debugger version of Flash Player as described in “Configuring the
debugger version of Flash Player to record trace() output” on page 232.
Using the logging API
The logging API lets an application capture and write messages to a target’s configured output. Typically the
output is equivalent to the global
trace() method, but it can be anything that an active target supports.










