118
Chapter 15: Work with Objects and Classes Using ActionScript 2.0
}
public function setID (id:Number) :Void
{
this.id = id;
}
public function setProdName (prodName:String) :Void
{
this.prodName = prodName;
}
public function setDescription (description:String) :Void
{
this.description = description;
}
public function getID () :Number {
return id;
}
public function getProdName () :String {
return prodName
}
public function getDescription () :String {
return description;
}
}
6.
Save your file.
Note:
An example finished file of the file you just created, named Product.as, is located in your
finished files folder. For the path, see
“Set up your workspace” on page 113
.
Create two objects from the Product class
You’ll create a new FLA file, then create two objects from the Product class.
1.
Open a new Flash document and save it in the same location where you saved Product.as.
2.
In the new document, select Frame 1 in the Timeline. In the Actions panel, create two objects
from the Product class using the data shown in the following table (the ActionScript that you’ll
create appears after the table).
Instance name
Data
pedals
id
0
prodName
Clipless Pedals
description
Excellent cleat engagement
handleBars
id
1
prodName
ATB
description
Available in comfort and aero design
Содержание 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...