ActionScript 3 Types Type Casting


Type casting is done with either the as operator:

var chair:Chair = furniture as Chair;

Or by wrapping the value in Type():

var chair:Chair = Chair(furniture);

If the cast fails with as, the result of that cast is null. If the cast fails by wrapping in Type(), a TypeError is thrown.