Trace an Action

[ LiB ] 

graphics/153fig02.jpg

A lot of times I run into an issue where my script won't work. I examine it, only to find no problems whatsoever. Or so it seems. The problem is that when you are the only one looking at your work and you've been staring at it for hours, it can be difficult to identify problems. Usually I find that I've done something really stupid, like misspelling a variable name.

One of the things that can quickly help you identify where a problem lies is the trace action. Add it at any place in your script, like this:

 trace("Hello World"); 

Now test your movie using CTRL-ENTER (or CMD-ENTER) and you'll see a new Output window appear with the words Hello World. Basically anything you put in the parentheses of a trace action will print to the Output window, whether it be a variable or a string value as we used previously. This can be very helpful to give you some immediate feedback or output to test your scripts.

[ LiB ] 


Macromedia Flash MX 2004 Killer Tips
Macromedia Flash MX 2004 Killer Tips
ISBN: 0735713839
EAN: 2147483647
Year: 2003
Pages: 300
Authors: Shane Elliott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net