Verify that you created the objects as follows:
3.
var handleBars:Product = new Product (1, "ATB", "Available in comfort and
aero design");
var pedals:Product=new Product(0,"Clipless Pedals","Excellent cleat
engagement");
Trace the description property of pedals:
4.
trace (pedals.getDescription ());
Save and test the document. You should see the description of pedals in the Output panel.
5.
Note: An example finished file of the document you just created, named handson2.fla, is located in
your finished files folder. For the path, see
About extending existing classes
The
keyword in ActionScript 2.0 allows you to use all the methods and properties of an
extends
existing class in a new class. For example, if you wanted to define a class that inherited everything
from the MovieClip class, you could use the following:
class Drag extends MovieClip
{}
The Drag class now inherits all properties and methods from the existing MovieClip class, and
you can use MovieClip properties and methods anywhere within the class definition, as in the
following example:
Note: The following ActionScript is an example only. You should not enter the script in your lesson
FLA file.
class Drag extends MovieClip
{
// constructor
function Drag ()
{
onPress=doDrag;
onRelease=doDrop;
}
private function doDrag():Void
{
this.startDrag();
}
private function doDrop():Void
{
this.stopDrag();
}
}
Note: The Convert to Symbol dialog box now offers a class field in which you can associate visual
objects (such as movie clip) with any class that you define in ActionScript 2.0.
"Set up your workspace" on page
About extending existing classes
113.
119
Need help?
Do you have a question about the FLASH MX 2004-LEARNING FLASH and is the answer not in the manual?
Questions and answers