开发者

Extend from Number class in Flex Action Script

I need a way to "extend" or proxy the Number class in ActionScript.

Basically I'll overload the toString method of it.

But the Numbers should remain comparable with "<" and ">" 开发者_开发问答operators.


You can't extend Number. The class if marked final:

http://livedocs.adobe.com/flex/3/langref/Number.html

Number, as best I understood it, is more like a primitive to the flash player, not a class that can be morphed to our own needs.

I would not expect there to be a way to proxy the class while also retaining the ability to do '>' or '<' comparisons unless you write your own "greaterThan' and "lessThan' methods.


I think you need to use a little Util-class, let's call it "NumberHelper" with a method "toString(number:Number):String" So you can work with "normal" Numbers and if you want to change it to a string you use this Util-class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜