I am new to ActionScript 3 and have run into a problem:
Using Flex Builder 3, I have a created a project with a few simple classes. If code in class A instantiates an object of class B (class B is in its own source file) then the code compiles fine, but I get the following run time error:
ArgumentError: Error #2012: B class cannot be instantiated.
Can someone explain what I'm doing wrong?
Update: Please see my own answer below (I could not vote it to the top since I'm not yet registered).
I finally realized what was wrong: Class B was subclassing from DisplayObject which I now see is an abstract class. Class B did not implement the abstract members, thus the error. I'll probably change class B to subclass from Sprite instead.
This seems like a problem that should have been caught by the compiler. Does the fact that it wasn't mean implementation of abstract members can wait until run time? Even if so, it would be nice to at least get a compiler warning.
Thanks for everyone's answers, hopefully they will help others who run into error 2012.