【发布时间】:2011-03-11 13:24:04
【问题描述】:
我有一个继承自 Sprite 的类 (Wall)。
Sprite 已经具有宽度和高度属性。但是对于墙,我需要在属性更改时进行一些其他额外的计算(例如,确保新尺寸不会导致它与任何其他墙重叠)。
那么,如何在 Wall 的宽度设置器中设置继承自 Sprite 类的宽度属性? (或者也许有另一种方法可以在设置宽度时进行边界检查?)
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?
}
【问题讨论】:
标签: actionscript-3 inheritance overriding getter-setter