Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to add comma and dollar sign that places automatically in input text field

Guest
Oct 12, 2008 Oct 12, 2008
I have this ROI calculator which has several text input field on frame one with calculate and reset buttons. When a user enters numerical values in the text field, and jumping to the next field, I want the input text filed be updated with dollar sign and with comma.

Next when they hit "ENTER" key or click "Calculate ROI" button, all the input text fields on frame 2 as a result of calculations be updated with dollar sign and comma. I also need that once the comma sign is assigned then it would not add any more even if user presses the button. Can someone help me in this?
TOPICS
ActionScript
942
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 13, 2008 Oct 13, 2008
If you want to Set the Comma when you Switch to next Text Field

Use onKillFocus / onSetFocus Functions.

to restrict multiple comma, Before Adding comma use

myText.text = myText.text.split(",").join("").split("$").join("");

So this will give you the value without Comma and Dollar symbol, Now add the Comma and dollar.

or you need to use a Flag for onChange Event.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 24, 2008 Oct 24, 2008
LATEST
Devendran,

Thanks for your respond. Could you please provide me onKillFocus/onSetFocus function code? Also how do I make addition of decimal values? say, I want to pull data from xml file which has some decimal values and I want to make addition to get an new value in my text field. In simple, what is the code to calculate (addition) decimal value? Once again thanks for your response.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines