Copy link to clipboard
Copied
Hi there,
I want to have the user type in their name and click spin.
Upon clicking the button, it changes from Scene 1 (where the user types name) to Scene 2 where it displays the result.
After the spin it returns the result and congratulates the user.
I want to display what the user typed in from the previous scene.
Scene 1 on my button:
var str:String = fName.text;
Scene 2 :
label1.text = str;
Below is exactly my issue, however I do not understand the answer,
Passing values from one scene to another
I have also tried:
var firstname:String;
fName.addEventListener(Event.CHANGE, inputCapture1);
function inputCapture1(e:Event):void{
firstname = fName.text;
}
Hi.
It could be something like this:
AS3:
[Input scene]
import flash.events.MouseEvent;
var savedName:String;
function inputName(e:MouseEvent):void
{
gotoAndStop(1, "Input");
}
function showResult(e:MouseEvent):void
{
savedName = nameText.text;
gotoAndStop(1, "Result");
}
stop();
spinButton.addEventListener(MouseEvent.CLICK, showResult);
[Result scene]
resultText.text = savedName;
backButton.addEventListener(MouseEvent.CLICK, inputName);
FLA download:
animate_cc_as3_input_text_2.zip - Google Drive
Regards
...Copy link to clipboard
Copied
Hi.
It could be something like this:
AS3:
[Input scene]
import flash.events.MouseEvent;
var savedName:String;
function inputName(e:MouseEvent):void
{
gotoAndStop(1, "Input");
}
function showResult(e:MouseEvent):void
{
savedName = nameText.text;
gotoAndStop(1, "Result");
}
stop();
spinButton.addEventListener(MouseEvent.CLICK, showResult);
[Result scene]
resultText.text = savedName;
backButton.addEventListener(MouseEvent.CLICK, inputName);
FLA download:
animate_cc_as3_input_text_2.zip - Google Drive
Regards,
JC