Skip to main content
May 22, 2007
Question

How to redo a string

  • May 22, 2007
  • 4 replies
  • 220 views
I'm building a form for users and gathering their information using simple strings like

var contactFirst:String = contactFirstName.text;

The problem I'm having is at the end of the form, I ask the user if they made a mistake to go back and correct it before continuing. On the button they press after correcting their mistake I have the same code:

var contactFirst:String = contactFirstName.text;

Assuming it will wipe the string and put in the newly inputted information. It doesn't. If Johnny changes his name to Tommy, the system still calls him Johnny.

help?
This topic has been closed for replies.

4 replies

kglad
Community Expert
Community Expert
May 22, 2007
and don't use the var prefix or you'll make contactFirst local to that method and unavailable outside it.
kglad
Community Expert
Community Expert
May 22, 2007
almost. the onChanged method should be applied to your textfield, not your textfield's text property.
May 22, 2007
Thanks, Kglad.

Not sure I'm getting you, though. Would the right usage be:

contactFirstName.text.onChanged = function() {
var contactFirst:String = contactFirstName.text;
}

?
kglad
Community Expert
Community Expert
May 22, 2007
use the onChanged method of textfields to assign your variable's value.