thanks all, @reflaxations, what u r suggesting is the composition technique i tried, the results are not impressive. @josh, googling didn't help either. maybe i should make myself a bit clearer. Am developing a financial Calculation software (bond value, maturity value,...bla bla bla), so i do a lot of complex calculations, but whatever my result is, must be presented in currency format.Sometimes i display the result on labels and sometimes in list controls.And one thing is the calculations are real-time, that is there is no calculate button, as the user inputs, things are calculated. I hope u guys get. Thanks very much.
MayorBrain --- Josh McDonald <[EMAIL PROTECTED]> wrote: > More importantly, you don't want to use regular > floating point numbers for > currency math, anyway. You want seperate dollars and > cents (and possibly > partial cents) integers internally to your class. > > -J > > On Feb 11, 2008 3:41 PM, reflexactions > <[EMAIL PROTECTED]> wrote: > > > Yeah but with all the numeric classes now being > final its a non- > > starter. > > > > In AS2 we used to extend Number for some very > valid reasons (like > > enums and a 32/24 bit color class) but things > change and "final" is > > well, final so you need a Currency class. > > > > If you need to handle math either give it a > valueOf function or > > include "add", "subtract" methods etc.. > > > > --- In [email protected] > <flexcomponents%40yahoogroups.com>, > > "Michael Labriola" > > > > <[EMAIL PROTECTED]> wrote: > > > > > > > > > Unless you want to really treat it like a > number... doing math on > > it, > > > passing it around as a value. That's the reason > I think it is > > > important to understand the goal, not just the > result > > > > > > --- In [email protected] > <flexcomponents%40yahoogroups.com>, > > "reflexactions" > > > <reflexactions@> wrote: > > > > > > > > Just create a Currency class that takes a > Number and a CCY code > > in > > > > the constructor and overrides toString to do > the formatting that > > you > > > > want, nothing hacky about that. > > > > > > > > > > > > --- In > [email protected]<flexcomponents%40yahoogroups.com>, > > okegbenle mayowa > > > > <brainny2002@> wrote: > > > > > > > > > > hello > > > > > looking at the subject, the first thing that > comes to > > > > > ur mind is "doesn't this guy know the number > class is > > > > > a base class", but what the heck, i need > some extra > > > > > functionality. Anyway this is my scenerio: > > > > > What i need is a number class with a > toString() method > > > > > that outputs a currency formatted number. > > > > > > > > > > eg var num:Number = new Number(3000) > > > > > Alert.show(num.toString());//outputs $3,000. > > > > > > > > > > In the past i had used ItemRenderers with > the > > > > > CurrencyFormatter acting on the data > property. later i > > > > > got tired of itemrenderers and decided to > find a more > > > > > sleek approach.My first disappointment was > remembering > > > > > that the Number class is a base class, ok > then next > > > > > thought was to see if i could copy the > Number Class > > > > > source code from the framework, upon > checking i > > > > > decided it was better not attempted.So the > my last > > > > > option is the composition technique(since > inheritance > > > > > was impossible). This produced some very > hacky class > > > > > which am not proud of, so is there a very > cool way to > > > > > solve my problem. > > > > > > > > > > MayorBrain > > > > > > > > > > > > > > > > > > > > > > > > > > > __________________________________________________________ > > > > ______________ > > > > > Never miss a thing. Make Yahoo your home > page. > > > > > http://www.yahoo.com/r/hs > > > > > > > > > > > > > > > > > > > > > > -- > "Good people will do good things, and bad people > will do bad things. But for > good people to do bad thingsĀthat takes religion." > > :: Josh 'G-Funk' McDonald > :: 0437 221 380 :: [EMAIL PROTECTED] > ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
