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

take Text from TextInput on Scene 1, Display it in Scene 2 Label

New Here ,
Aug 02, 2019 Aug 02, 2019

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; 

Views

219

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Aug 02, 2019 Aug 02, 2019

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

...

Votes

Translate

Translate
Community Expert ,
Aug 02, 2019 Aug 02, 2019

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

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