OOP class variables question

Hey :smirk:

Not too long ago I started using Flash CS3 and AS3. OOP is completely new for me, but I’m getting the hang of it with time. But I have a question -

I have a class which extends a movieclip, that class is a unit. In my game, there’s a player unit and an enemy unit. I’m using the same class for both, the only difference is a boolean inside that tells if it’s an enemy or a player unit, which affects what array of units in the above class they should be looping and checking for foes nearby.

To create a unit, what I do, and I figured is wrong, is after creating the unit in a create unit function I have, only then I set the boolean, from the outside, for instance:
unit = new unit_mc;
unit.isPlayer = true;

So ‘in the long run’ it plays fine, but when I create the class first, it already run loops and ifs regarding the isPlayer boolean, which wasn’t yet defined, but only a line after.

So my question is, is there a way to define a boolean from the outside in the same time of creation? If not, how else can I solve this issue?
I thought about making a class that extends Unit, that only sets the boolean (using super.isPlayer, I believe?), but is it right to work that way?

Thanks a bunch!