The command trace () is used to display something on the output panel. Usage of trace action is very useful in further programming later, as fault testing in a program line. An example of using trace action script as following:
- Click frame 1, then open the action panel and typing the script: trace (1000); then run the movie by pressing CTRL+Enter. It will appear the text "1000" on the output panel.
- Press Ctrl + W to return to the Stage. Next change the action in frame 1 become: trace ("hello how are you?"); Then run movie again. So it will appear in output panel as follows:
- Press Ctrl + W to return to the Stage. Next change the action in frame 1 become: trace (number); Then run movie again. So it will appear in output panel as follows:
- Press Ctrl + W to return to the Stage. Next add the action in frame 1 becomes:
number = 1000;
trace (number);
Then run movie again. So the view that emerges is as follows:
The conclusion that can be taken are as follows:
- Value inside () in the action trace () can be filled with numbers.
- Word "hello how are you?" can be displayed because it is a string object (located inside "").
- Word number can not be displayed, because not enclosed in "", so the word number is considered as a variable that must be defined first.
- Additional action number = 1000; is defining the number variable, so this variable is valued at 1000 and can be displayed by the action trace ().
0 Comments