views:

40

answers:

2

Hi,

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.

+2  A: 

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.

www.Flextras.com
+1  A: 

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.

hering