![MACROMEDIA FLASH MX 2004-LEARNING FLASH Скачать руководство пользователя страница 37](http://html1.mh-extra.com/html/macromedia/flash-mx-2004-learning-flash/flash-mx-2004-learning-flash_manual_3379009037.webp)
Specify values for input text fields
37
1.
Select File > Publish Settings.
2.
On the Flash tab of the Publish Settings dialog box, select ActionScript 2.0 in the ActionScript
Version pop-up menu, if it’s not already selected.
3.
In the Timeline, click the Components layer to select it.
4.
From the Components panel (Window > Development Panels > Components), drag the
Button component to the Stage and place it over the Calculate guide.
5.
On the Parameters tab of the Property inspector, with the Button component selected, click the
Button text on the Label row, and type
Calculate
. Then press Enter or Return.
The text that you type in the Label text box is the text that appears on the component.
6.
In the Instance Name text box, enter
calculate
to provide the button with an instance name.
Declare variables and values for the prices
For your application to multiply the quantity of parts selected by the price of the part, you need
to define a variable for each part in ActionScript. The value for the variable is the cost of the part.
1.
In the Timeline, click Frame 1 of the Actions layer and open the Actions panel (Window >
Development Panels > Actions).
2.
In the Script pane, type
//declare variables and values for car part prices
.
The parallel slashes (//) indicate that the text that follows is a comment. As a best practice,
always add comments that offer an explanation of your ActionScript.
Note:
As you take this lesson, you might find that you’d like to turn off code hints—the tooltips that
prompt you with the correct ActionScript syntax. If so, you can turn off code hinting by clicking the
options menu in the upper right corner of the Actions panel. Select Preferences, and then deselect
Code Hints on the ActionScript tab.
3.
Press Enter or Return and type the following to indicate the cost of each part:
var priceCD = 320;
var priceShocks = 150;
var priceCover = 125;
Specify values for input text fields
You’ll specify values for the input text fields. You’ll use the values when you write ActionScript
that multiplies the quantity and cost values.
1.
In the Script pane, with the insertion point after the text that reads
125;
, press Enter or Return
twice and type the following comment:
//set initial values for the quantity text fields
2.
Press Enter or Return, and type the following:
qty1_txt.text = 0;
qty1_txt
is the instance name that you gave the first input text field under the QTY column.
.text
is a property that defines the initial value in the text field, which you specify is
0
.
Содержание 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...