| 1 |
Choose File > Open and choose the version of the MyPuzzle.fla movie that you last saved. |
| 2 |
Click the Show/Hide Piece number guide button and Choose Window > Actions. |
| 3 |
Double-click the if action in the Actions category in the Toolbox list. The following code appears in the Actions panel: |
|
on (release) {
if (<not set yet>) {
}
}
|
| 4 |
Select the second line of code (the line that contains the if action) and double-click the else action in the Toolbox list. |
|
The code looks like the following: |
|
on (release) {
if (<not set yet>) {
} else {
}
}
|
| 5 |
Select the second line of code and, with the insertion point in the Condition text box, click the Insert Target Path button. Choose the piecenumbers movie clip, Dots notation and Absolute path and click OK. The following code appears in the Condition text box: |
|
|
| 6 |
With the insertion point in the Condition text box, enter ._visible. |
|
You can enter the code manually, or you can choose _visible from the Properties category in the Toolbox list. |
| 7 |
From the Actions category in the Toolbox list, double-click the evaluate action to add an empty line of code. |
| 8 |
Enter _root.piecenumbers._visible = false in the Expression text box. |
|
You can use the Insert Target Path button or enter the code manually. The code now looks like the following: |
|
on (release) {
if (_root.piecenumbers._visible) {
_root.piecenumbers._visible = false;
} else {
}
}
|
|
When the movie plays, Flash evaluates the expression inside the condition parentheses. The expression must equal one of the Boolean values: true or false . This example uses the condition of the if action to check if the piecenumbers movie clip is visible on the Stage. If the _visible property is true , ActionScript runs the code inside the curly brackets and sets the _visible property to false , which hides the movie clip on the Stage. |
| 9 |
Select the line of code with the else action and double-click the evaluate action. |
| 10 |
In the Expression text box, enter _root.piecenumbers._visible = true. |
|
The final ActionScript code looks like this: |
|
on (release) {
if (_root.piecenumbers._visible) {
_root.piecenumbers._visible = false;
} else {
_root.piecenumbers._visible = true;
}
}
|
| 11 |
Choose File > Save As and enter a new filename. Use a consecutive naming scheme so you can revert to earlier versions of the file. |
 |
|