Specifications
Create a custom class 261
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 selecting File > New > ActionScript File 
(Not Flash Document). Save the document with the name Product.as.
2. Create a constructor for a Product class by creating a function called 
Product that takes the arguments 
id, prodName, and description:
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 keyword with the constructor function. 
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);
}
}
5.
Define getter and setter methods for each property of the class, as in the 
following example. 
Specify 
Void as the return type for the setter methods, and indicate the 
data type returned for the getter methods. 
class Product
{
var id:Number;
var prodName:String;
var description:String










