Summary
33
//function to hide animation
this.offButton_btn.onRelease = function(){
screen_mc._visible = false;
};
Check syntax and test your application
As you learned earlier in this lesson, ActionScript depends on correct syntax to execute properly.
Flash offers a variety of ways for you to test your syntax.
1.
To check the syntax, do one of the following:
■
Click the options menu in the upper right corner of the Actions panel title bar and select
Check Syntax.
■
Click the Check Syntax button along the top of the Actions panel.
If the syntax is correct, a message appears stating that the script contains no errors.
If the syntax is incorrect, a message appears stating the script contains errors; the Output panel
opens and displays information about the error.
2.
Click OK to close the syntax message.
3.
After you’ve verified that your ActionScript does not contain syntax errors, save the document
and select Control > Test Movie.
When the SWF file appears, the animation should not appear in the Global Positioning
System screen, because its initial
visible
property is set to
false
. When you click and release
the top green button, you call the function that sets the movie clip’s
visible
property to
true
.
Does the animation play then? Finally, click the red Off button to see if the
visible
property
for the animation is again
false
.
You can test your SWF content throughout authoring to confirm that it plays as expected.
Summary
Congratulations on learning a few basics about writing scripts with ActionScript. In a short
amount of time, you learned how to accomplish the following tasks:
•
Name instances following recommended practices
•
Initialize a document
•
Apply ActionScript syntax
•
Locate ActionScript reference documentation
•
Add comments to ActionScript
•
Write a function
•
Copy and modify a function
•
Check syntax and test your application
To learn more about ActionScript, select Help > How Do I > Quick Tasks >
Create an Application.
Содержание FLASH MX 2004-LEARNING FLASH
Страница 1: ...Learning Flash...
Страница 8: ...8 Contents...
Страница 34: ...34 Chapter 3 Write Scripts with ActionScript...
Страница 54: ...54 Chapter 6 Create a User Interface with Layout Tools...
Страница 62: ...62 Chapter 7 Draw in Flash...
Страница 68: ...68 Chapter 8 Create Symbols and Instances...
Страница 76: ...76 Chapter 9 Add Animation and Navigation to Buttons...
Страница 104: ...104 Chapter 13 Add Interactivity with ActionScript...
Страница 112: ...112 Chapter 14 Create a Form with Conditional Logic and Send Data...
Страница 122: ...122 Chapter 15 Work with Objects and Classes Using ActionScript 2 0...