I have this Player class which is a movieclip,
I'm trying to set it's width and height from it and then make it add itself to the stage,
But for some reason, no matter what I do, this.width returns 0 and setting the size only works from the parent class.. why is this happening?
public class Player extends MovieClip {
public var head:MovieClip = new Head_normal_front();
public function Player(stage:Stage){
this.addChild(head);
this.width = 10;
this.height = 10;
stage.addChild(this);
}
}
Thanks
Best Answer
Try something like the following :
You should modify the width/height of display objects after they are added to the stage. I would probably move the stage.addChild(this) outside of Player too.