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:

Note: The following ActionScript is an example only. You should not enter the script in your lesson FLA file.

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;
}