ActionScript for Flash MX: The Definitive Guide, Second Edition
ActionScript for Flash MX: The Definitive Guide, 2nd EditionBy Colin Moock
Chapter 18. ActionScript Language Reference
trace( ) Global Function
Flash 4
display a value in the Output window
trace(value)
Arguments
value
The expression to be resolved and then displayed in the Output window. If the resolved value of value is 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 in Chapter 3.
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. Because the Output window isn't available when we're testing in a browser or the Standalone Player, use an on-screen text field to display results, as follows:
Multiple trace( ) statements can slow down movie playback. To view a movie at its genuine speed, 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 and then output the expression
See Also
Object.watch( ); Chapter 17
About Safari | Terms of Service | Privacy Policy | Contact Us | Help | Submit a Problem
Copyright 2002 O'Reilly & Associates, Inc. All rights reserved.1005 Gravenstein Highway NorthSebastopol, CA 95472