views:

43

answers:

1

I have a class (Wall) that inherits from Sprite.

Sprite already has width and height properties. But for wall, I need to do some other additional calculations when the properties change (f.e. make sure the new size won't cause it to overlap any other walls).

So, how do I set the width property inherited from the Sprite class from within the width setter of the Wall? (or perhaps there is an alternative way to do my bounds checking whenever width is set?)

public override function set width(w:Number):void {
    //make sure it is a valid size
    //if it is, then set the width of the *Sprite* to w. How?
}
+4  A: 

super is what you are looking for:

    override public function set width(v:Number):void {
        if(v > 100) {
            super.width = v;
        }
    }
Juan Pablo Califano