Troubleshooting ActionScript > Using the Debugger > Displaying and modifying variables

Displaying and modifying variables

The Variables tab in the Debugger displays the names and values of any variables in the movie. If you change the value of a variable in the Variables tab, you can see the change reflected in the movie while it runs. For example, to test collision detection in a game, you could enter the variable value to position a ball in the correct location next to a wall.

To display a variable:

1 Select the movie clip containing the variable from the display list.
2 Click the Variables tab.

The display list updates automatically as the movie plays. If a movie clip is removed from the movie at a specific frame, that movie clip is also removed from the display list in the Debugger; this removes the variable name and value.

To modify a variable value:

Select the value and enter a new value.

The value must be a constant value (for example, "Hello", 3523, or "http://www.macromedia.com"), not an expression (for example, x + 2, or eval("name:" +i)). The value can be a string (any value surrounded by quotation marks ("")), a number, or a Boolean (true or false).

Object and Array variables are displayed in the Variables tab. Click on the Add (+) button to see their properties and values. However, you can't enter Object or Array values (for example, {name: "I am an object"} or [1, 2, 3]) in the values fields.

Note: To output the value of an expression in test-movie mode, use the trace action. See Using trace.