Name
trace( ) Global Function — display a value in the Output window
Availability
Flash 4 and later
Synopsis
trace(value)
Arguments
- value
The expression to be resolved and then displayed in the Output window. If the resolved value of
valueis not a string, it is converted to a string before being sent to the Output window, according to the rules described in Table 3.2.
Description
The trace( ) function is a debugging tool used
only within the Test Movie mode of the Flash authoring environment.
Though unassuming in nature, trace( ) is
actually one of the fundamental components of ActionScript
programming; it allows us to check the value of a variable or
expression at any point during the playback of a movie.
Usage
Unfortunately trace( ) can be quite slow. Turn
off tracing under File → Publish Settings → Flash using the
Omit Trace Actions option.
Example
trace(firstName); // Output the value of firstName
trace(myClip); // Output the path to myClip
trace(myClip._x) // Output the x coordinate of myClip
trace("hello" + " there"); // Resolve then output the expressionSee Also
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access