Or, split the string on the last '.', look at the length of the string after the dot, add 0s until it has a length of 2...
Ian On Tue, Jan 27, 2009 at 10:12 AM, allandt bik-elliott (thefieldcomic.com) <[email protected]> wrote: > you need to add it to a string and work out if the extra 0 is needed (maybe > with the modulo (%) comparison operator), in as2, and then manually add the > zero to the string when you output to your textfield > > do a search for as2 timers / digital clocks and you'll come across the > technique > > a > > On Tue, Jan 27, 2009 at 9:05 AM, jimmi <[email protected]> wrote: > >> Ah snap, i need it for AS2, is there any alternative for that? >> >> Best regards, >> Jim >> >> On Tue, Jan 27, 2009 at 9:53 AM, Sidney de Koning >> <[email protected]> wrote: >> > Hi Jim, >> > >> > In the Number class there is are a couple of functions to help you. You >> want >> > a function called toFixed(). >> > >> > so if you do Number(total).toFixed(2); You get the result you want :) >> > >> > This is pure AS3 though, >> > >> > Hope this helps, >> > >> > Sid >> > >> > On Jan 27, 2009, at 9:45 AM, jimmi wrote: >> > >> >> Goodmorning, i am trying to make a formula that makes for example 30.60 >> of >> >> 30.6. So I need it to add a 0. >> >> >> >> This is the formula I am using now. >> >> total = Number(Number(600) / 100 * Number(5.1)) >> >> >> >> I have tried all sorts of additions to the formula to try to get it to >> >> make 30.60 of 30.6. But no luck >> >> >> >> Anyone here who knows how to make the formula add a 0? >> >> >> >> Best regards, >> >> Jim >> >> _______________________________________________ >> >> Flashcoders mailing list >> >> [email protected] >> >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> > >> > Sidney de Koning - be a geek, in rockstar style! >> > Flash / AIR Developer @ www.funky-monkey.nl >> > Technical Writer @ www.insideria.com >> > >> > _______________________________________________ >> > Flashcoders mailing list >> > [email protected] >> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> > >> _______________________________________________ >> Flashcoders mailing list >> [email protected] >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

