![MACROMEDIA FLASH 8-FLASH Скачать руководство пользователя страница 260](http://html2.mh-extra.com/html/macromedia/flash-8-flash/flash-8-flash_tutorials-manual_3348958260.webp)
260 ActionScript: Work with Objects and Classes
To create objects from this class, you could now use the following code:
var cliplessPedal:Product=new Product(1, "Clipless Pedal",
11);
var monkeyBar:Product=new Product(2, "Monkey Bar", 10);
However, in ActionScript 2.0, variables that are part of a class structure
should not be accessed directly. Write methods within the class that will
access these variables directly. Different methods should get and set
properties (known as “getter” and “setter” methods). You must indicate the
data type for both a method’s return value and any parameters that are
passed to the method when it is called.
Specify the data type for method return
values
You must indicate data types for values returned by methods after the
method name and list of parameters, as in the following example:
public function getProductName() :String
{
return name;
}
If no value is returned (for example, a property is being set), the data type is
Void
:
public function setProductName(productName:String) :Void
{
this.productName=productName;
}
NO
TE
The following ActionScript is an example only. Do not enter the script in
your lesson FLA file.
NO
TE
The following ActionScript is an example only. Do not enter the script in
your lesson FLA file.
Содержание FLASH 8-FLASH
Страница 1: ...Flash Tutorials...
Страница 10: ...10 Contents...
Страница 12: ...12 Introduction...
Страница 42: ...42 Basic Tasks Creating a banner Part 1...
Страница 78: ...78 Basic Tasks Creating a banner Part 3...
Страница 88: ...88 Basic Tasks Create Accessible Flash Content...
Страница 106: ...106 Basic Tasks Create an Application...
Страница 116: ...116 Basic Tasks Use Layout Tools...
Страница 124: ...124 Basic Tasks Create Symbols and Instances...
Страница 134: ...134 Basic Tasks Add Button Animation and Navigation...
Страница 144: ...144 Basic Tasks Create a Presentation with Screens Flash Professional Only...
Страница 192: ...192 Creating Graphics Applying Gradients...
Страница 198: ...198 Creating Graphics Apply Graphic Filters and Blends Flash Professional Only...
Страница 224: ...224 ActionScript Use Script Assist mode...
Страница 268: ...268 ActionScript Work with Objects and Classes...
Страница 270: ...270 Data Integration Overview Flash Professional Only...