Highlighted

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

New Here ,
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; 

Adobe Community Professional
Correct answer by JoãoCésar | Adobe Community Professional

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

Views

88

Likes

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

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

New Here ,
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; 

Adobe Community Professional
Correct answer by JoãoCésar | Adobe Community Professional

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

Views

89

Likes

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
Aug 02, 2019 0
Adobe Community Professional ,
Aug 02, 2019

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

__________________________________________
HTML5, JSFL, and AS3 samples: http://bit.ly/2mJgDoG

Likes

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
Reply
Loading...
Aug 02, 2019 0