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