About casting

ActionScript 2.0 lets you cast one data type to another. Casting an object to a different type means you convert the value that the object or variable holds to a different type.

The results of a type cast vary depending on the data types involved. To cast an object to a different type, you wrap the object name in parentheses (()) and precede it with the name of the new type. For example, the following code takes a Boolean value and casts it to an integer.

var myBoolean:Boolean = true;
var myNumber:Number = Number(myBoolean);

For more information on casting, see the following topics:


Flash CS3