![MACROMEDIA FLASH MX 2004-LEARNING FLASH Скачать руководство пользователя страница 31](http://html1.mh-extra.com/html/macromedia/flash-mx-2004-learning-flash/flash-mx-2004-learning-flash_manual_3379009031.webp)
Write a function for a button
31
Later in this lesson, you’ll use Flash features that allow you to test your syntax.
Locate ActionScript reference documentation
During authoring, if you’d like additional information about the ActionScript that you enter, you
can select the action in the Actions toolbox or Script pane and click the Reference button. The
Help panel displays information about the selected action.
1.
In the Script pane of the Actions panel, double-click
visible
to select the term.
Note:
After completing the next step, you’ll change topics in the Help panel and you will no longer
be on this lesson topic. Click the How Do I tab to return to this topic.
2.
Along the top of the Actions panel, click the Reference icon.
The
visible
entry in the Help panel appears.
Add comments to ActionScript
In ActionScript, text after double slashes (//) is commented text, which Macromedia Flash Player
ignores. Commented text often documents script functionality so that other developers can
understand your script, but you can also use comments to deactivate sections of your script when
debugging. As a best practice, always add comments that explain your scripts.
•
In the Script pane of the Actions panel, place the insertion point at the beginning of the line
of code and type
//Initialize document to hide screen movie clip
. Press Enter
or Return.
Text in the Script pane appears as follows:
//Initialize document to hide screen movie clip.
this.screen_mc._visible = false;
Note:
If your commented text is many lines, you can use /* instead of double slashes for the
beginning of the comment, and */ to mark the end of the comment.
Write a function for a button
A command in ActionScript is called a function. A function is a script that you can write once
and use repeatedly in a document to perform a certain task. You’re going to write a function
that makes the screen_mc movie clip appear (
visible = true
) when the user releases the
mouse button.
1.
In the Script pane of the Actions panel, click after the last line of code, press Enter or Return
twice, and type
//function to show animation
.
2.
Press Enter or Return and click Insert Target Path, along the top of the Actions panel. Select
onButton_btn from the hierarchical tree, and click OK.
3.
In the Script pane, type a period (
.
) and double-click
onRelease
from the list of code hints
that appears.
Содержание 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...