MACROMEDIA FLASH 8-FLASH Tutorials Manual page 261

Hide thumbs Also See for FLASH 8-FLASH:
Table of Contents

Advertisement

Build a custom class
You'll now build a new Product class with getter and setter methods and
create an object from the Product class.
1.
Create an ActionScript file by doing one of the following:
If you're using Flash Professional 8, select File > New > ActionScript
File (Not Flash Document). Save the document with the name
Product.
If you're using Flash Basic 8, open a text editor, such as Notepad.
Save the file with the name Product.as. (Remember to give the file
the .as extension, to create an ActionScript file.)
2.
Create a constructor for a Product class by creating a function called
Product that takes the arguments
function Product (id:Number, prodName:String,
description:String)
{}
3.
In the constructor function, set the properties of the Product class equal
to the setter methods that you will create:
setID(id);
setProdName(prodName);
setDescription(description);
4.
Surround the
class
Declare each variable used in the class:
class Product
{
var id:Number;
var prodName:String;
var description:String
function Product (id:Number, prodName:String,
description:String)
{
setID(id);
setProdName(prodName);
setDescription(description);
}
}
,
id
prodName
keyword with the constructor function.
, and
:
description
Create a custom class 261

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-FLASH and is the answer not in the manual?

Table of Contents

Save PDF