Passing Data from Input Field to Dynamic Text Box

Sorry guys if someone has covered this but I couldn’t find the answer in past threads.

Basically I just need information that is entered by the user into a input field to be passed to a dynamic text box.

Ie on a contact form when they submit their request a message is displayed saying "Thankyou{users name}, your request has been recieved.

The rest of the form is working, it’s just this bit!!!

Any info would be gratefully received.

I tried it…But I can’t get it to work,

What Code am I missing on Fame 2?

When I press the not working button and it goed to fame 2 …“Thank you UNDEFINED”

Thanks

Can’t upload the fla. Here is the code in Fame 1:
myButton.onRelease = function () {
var myusername_var1 = myUsername.text;
myResult2.text = myusername_var1;
gotoAndplay(2);
}

Here is the code in Fame 2:

myResult2.text ="Thank you "+ myusername_var1;
stop();

Got it…I think

Is this correct?

I changed the following

Fame 1:
myButton.onRelease = function () {
_global.myusername_var1 = myUsername.text;
myResult2.text = myusername_var1;
gotoAndplay(2);
}

Here is the code in Fame 2:

myResult2.text ="Thank you "+ _global.myusername_var1;
stop();

Noticed last night it would work if I removed the gotoAndStop(2);
I had tried using _global but still no joy.

I notice in your code you have gotoAndPlay(2)… why would that make a difference?

:hangover: I don’t know. Sorry I can’t answer that. I was trying different things and I guess I left GOTOANDPLAY instead of the original gotoandstop.

Did the fla I loaded work for you?

Ok, you call the function in frameX, define the dynamicText there with “thanks + username”; then go to frame Y to display.
This can’t work, as when you set the dynamic textfields text, it does not exist yet for flash, as it only appears on hte following frame; so your text gets lost!
that’s why it (should) work(s) with _global, the _global var will still be available, but you’ll still have to script dynaTxtfield.text on the frame it appears…
hope this explanation is not too messy… :wink:

hey,

that’s makes sense but I did try that last night and no joy. also if I added a trace and removed the gotoAndStop(2) line the variables contents would appear in the output window, if I added the gotoAndStop(2) line back in the trace would come back with nadda, nothing… why?

if I have no joy tonight I’ll post code on here later…

thanks for everyones help.

because, as i just explained, on frame 2, the var is not defined anymore… :slight_smile:
[AS] myBtn.onRelease = function() {
_global.username = input_field.text;
gotoAndStop(2);
}
[/AS]
frame2: textfield.text = _global.username;