I have the following classes in ActionScript:
public class A {
}
public class B extends A {
}
and these variables (in another class):
public var InstanceOfA:A;
public var InstanceOfB:B;
How do I cast an instance of A as a class B?
I tried:
InstanceOfA = new A();
InstanceOfB = InstanceOfA as B;
trace(InstanceOfB);
I get an object of type A for InstanceOfB.
I also tried:
instanceOfB = B(InstanceOfA);
In this case, I get a 'Type Coercion Failed' error.