I have a base class called Room and a subclass called Attic, and another called Basement.
I have a controller class that has a
Here are your options for casting in ActionScript 3:
Use as.
var myAttic:Attic = Controller.CurrentLocation as Attic; // Assignment.
(Controller.CurrentLocation as Attic).propertyOrMethod(); // In-line use.
This will assign null to myAttic if the cast fails.
Wrap in Type().
var myAttic:Attic = Attic(Controller.CurrentLocation); // Assignment.
Attic(Controller.CurrentLocation).propertyOrMethod(); // In-line use.
This throws a TypeError if the cast fails.