Monday, October 19, 2009

First Program using AS3

Using the trace() statement:

The trace() statement will become your best friend in ActionScript development. trace() statement helps to find the value for a variable at runtime. Much of the ActionScript functionality you will create does not have a visual result on the stage, so it can be difficult to tell if your ActionScript is doing its job properly in the background.
The trace() statement displays the results of your ActionScript as messages in the output panel at runtime.

To trace a value to the Output panel:

1. Create a new Flash file.
2. Select the first keyframe on Layer 1 and launch the Actions panel(f9).
3. Add the following ActionScript:
trace("the sum of 2+2 is :")
trace(2+2);
4. Press Ctrl+Enter(Win) or Cmd+Enter(Mac) to preview the results of your script.
5. The results of the script will be displayed in the Output panel.

trace.fla

No comments: