I notice in older version of flash you can create an instance of a dynamic class. I am creating a game that will have many different classes that can be displayed on the sta
Yes, like I said, to answer your original question, what you have above will work in AS3 as it did in older versions of AS. So if it's not a big deal, you can go with it.
Overall, I wouldn't say dynamic initialization goes against OOP, per se. However, it just feels a little like a hack. Everytime I start to use something like that, I almost always find a design change that cleanly fixes the problem.
Of course it's hard to spot that change without knowing a LOT about your application. To take a stab at it:
Do you even need different classes for each brick?
Could you just set some property that ultimately changes it's behavior (like this.strength = 2)?
Then, while iterating through the array you do something like
for(var brickType:int in brickArray) {
addBrickToScreenOrWhatever( new Brick(brickType) );
}
Where the constructor Brick(int)
creates a new Brick
with a strength equal to that of the parameter.