![MACROMEDIA FLASH MX 2004-LEARNING FLASH Скачать руководство пользователя страница 30](http://html1.mh-extra.com/html/macromedia/flash-mx-2004-learning-flash/flash-mx-2004-learning-flash_manual_3379009030.webp)
30
Chapter 3: Write Scripts with ActionScript
Initialize the document
Applications have an initial state that specifies how the content first appears to users. You initialize
properties and variables in the first frame of a document. You’ll specify that the map movie clip
not be visible when the SWF file first plays.
1.
Select Frame 1 of the Actions layer. If the Actions panel isn’t open, select Window >
Development Panels > Actions.
Actions - Frame appears at the top of the panel, which indicates that you selected a frame in
which to apply ActionScript. It’s a good practice to verify that you’re attaching ActionScript to
the intended frame or object.
The Actions panel includes a Script pane, the blank text entry area, in which you can enter text
directly; an Actions toolbox, which lets you select ActionScript to add to your script; and a
Script navigator, which functions like the Movie Explorer.
2.
Along the top of the Actions panel, click Insert Target path.
3.
In the Insert Target Path dialog box, verify that Relative, meaning relative path, is selected.
From the hierarchical tree in the dialog box, select screen_mc. Then click OK.
A target path tells ActionScript the location of an object within the overall structure of
a document. For more information about paths, see “Using absolute and relative target paths”
in
Using Flash
.
4.
Click in the Script pane, at the end of the screen_mc text, and type a period (
.
).
5.
When you type the period, code hints appear for the movie clip, because you used the _mc suffix
when naming the instance. Double-click
_visible
from the list of code hints, and type
the following:
= false;
This line of code makes the screen_mc movie clip invisible on the Stage.
Note:
If code hints don’t appear, you don’t have code hints selected as a preference in the Actions
panel. You can type
_visible
directly in the Script pane. You can also change your preferences by
clicking the options menu in the upper right corner of the Actions panel. From the options menu,
select Preferences, and then select Code Hints on the ActionScript tab.
Throughout authoring, remember to save your document frequently.
About ActionScript syntax
All languages, whether computer languages or written and spoken “human” languages, follow
specific rules that foster comprehension. These rules are known as the language syntax.
Flash uses dot syntax, which means that the period (.) links parts of a script. Other ActionScript
syntax elements include the following:
•
A semicolon (;) in an ActionScript statement, like a period in an ordinary sentence, indicates
the end of a statement.
•
Parentheses () group arguments that apply to an ActionScript statement.
•
Curly braces {} group related ActionScript statements. You can use nested braces to create a
hierarchy of statements.
Содержание 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...