| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
|
I have a calculator I am building in flash and want to format the input boxes to the following format:
user input: 2300000 return: 23,000.00 ---> I wnat all fields to follow this formating rule regardless of what they enter. So two intergers from the right insert decimal, and for every three intergers from the decimal insert a comma. It is a calculator and it needs to be able to perform mathamatical equations. thanks. Xperimental. |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2000
Location: Australia
Posts: 8,612
|
That would mean you'd have to actually calculate based on other varaibles. If the user enters 123450 and you format it to 1,234.50 you're not going to be able to us that variable in a mathermatical equation any more coz it has non-numerical characters in it.
But if you still want to do it you can use length() and substring. As a matter of fact, if you checkout Flashguru's Function Library int he tutorials section you could use that. Convert the data to an array, then use his reverse array. Then insert values from left to right (which will be easier using substring() ) then reverse the array again.... It's not going to be too dificult, so you try scripting it first. If you can't, I'll help out. Cheers Jesse
__________________
Cheers Jesse Stratford ActionScript.org Cofounder Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org Please don't email or PM me Flash questions, that's what the Forums are for! ![]() Please don't rely on me reading my PMs either. Email me about important stuff. |
|
|
|
|
|
|
|
|
#3 |
|
Registered User
|
Thanks for the reply,
The hardest part is the ",". And as of this second I've gotten kinda lost with what you said. But I'll do some digging. My script so far is working fine, a lot of variables are being passed around, and the "." works alright with an equation, it's just the blessed "," that messes it up. We'll see how it goes,and when it's done I'll let you know how it turned out. Thanxs. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| text field height? | circa1977 | Other Flash General Questions | 6 | 03-29-2007 11:07 PM |
| calling a PDF file in Flash | AudryLucy | Projectors and CDs | 20 | 12-30-2006 02:43 PM |
| dynamic text field in button | suzu | ActionScript 2.0 | 4 | 02-12-2006 09:56 PM |
| Changing dynamic text field from _root? | wmbenedetto | ActionScript 2.0 | 2 | 01-24-2006 02:34 AM |
| dynamic text field is calling the variable name instead of variable content | thomPhelps | Other Flash General Questions | 6 | 03-11-2004 11:02 AM |