Debugging Your ActionScript

When you design a Flash Web site, you need to ensure that your interface, and every movie that loads into it, plays flawlessly and that your ActionScript executes without a hitch. If you can see what's going on in each Flash movie as it is playing, you stand a better chance of exterminating the bugs before you publish the Web site and upload it to a Web hosting service. Failure to eliminate every bug in your Flash Web site will not gain you any favor with your client or your client's intended audience, which will dwindle rapidly after encountering a bug or four. For this sundry task, you use a device with the ubiquitous name of Debugger:

1. Choose Control --> Debug Movie from the menu.

This publishes the movie in another window and displays the Debugger window

2. Click the Continue button (it looks like a Play button) in the Debugger to begin playing and debugging your movie.

The status bar at the top of the Debugger window tells you the location of the movie you are debugging. The window below the status bar displays all of the movie clips in your movie, including those external movies that load into your interface when you click a button. Notice the tabs just below the movie clip list in the Debugger window. These tabs are populated with values after you click the Continue button, which begins playing the movie. These allow you to further analyze individual elements in your movie to detect any glitches:

Properties: This tab enables you to view the properties and the values of properties of a selected movie clip and change them as the movie runs. To do this, click a movie clip in the top display list; the Properties tab values update. Double-click any of the active values in this tab and enter a different value to preview the effect it will have on your movie.

Variables: This tab allows you to view the variables and the values of variables used in a selected movie clip. Click the Variables tab to view variables associated with the currently selected item from the display list. The variables update as the movie plays. To see the effect a different value will have, double-click a variable value in this tab and then enter a new value.

• If the properties and variables are not visible, click the divider bar above Call Stack and drag down to reveal them.

Locals: This tab displays the local variables used in the movie and the value of each variable.

Watch: This tab allows you to monitor selected variables closely. When you first launch the Debugger, no variables are on the Watch list. You can add variables to this list by selecting them in the Variables tab and then choosing Add Watch from the Debugger Options menu. Alternatively, you can select the variable, right-click (Windows) or Control-click (Macintosh), and choose Watch from the context menu. In the Variables tab, a blue dot appears to the left of a watched variable.

• To remove a variable from the Watch list, select the variable in the Watch list and choose Remove Watch from the Debugger Options menu. Alternatively, you can select the variable in the Watch list, right-click (Windows) or Control-click (Macintosh), and choose Remove from the context menu.

blog comments powered by Disqus
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.