Highlighted

help with dynamic text in animate cc

New Here ,
May 23, 2020

Copy link to clipboard

Copied

hello how are you, i have this problem in a dynamic text i want numbers to appear from a simple sum, my code is this

Var sum: Number = 1;

var counter: Number;

counter = sum +1; Text.text = "" + counter;

but it doesn't appear in the dynamic text and the instance of the dynamic text is called Text

Views

349

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

help with dynamic text in animate cc

New Here ,
May 23, 2020

Copy link to clipboard

Copied

hello how are you, i have this problem in a dynamic text i want numbers to appear from a simple sum, my code is this

Var sum: Number = 1;

var counter: Number;

counter = sum +1; Text.text = "" + counter;

but it doesn't appear in the dynamic text and the instance of the dynamic text is called Text

Views

350

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
May 23, 2020 0
Adobe Community Professional ,
May 24, 2020

Copy link to clipboard

Copied

Hi.

 

It's because you didn't initialize the counter variable.

 

It should be something like:

var counter:Number = 0;

 

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...
May 24, 2020 0
ClayUUID LATEST
Adobe Community Professional ,
May 25, 2020

Copy link to clipboard

Copied

That would be the solution if he was doing counter++, which he's not.

 

cristianrnumbers, what do you see if you replace the text display code with:

Text.text = "HELLO";

?

 

Also, using "Text" as an instance name is a terrible, no good, very bad idea. "Text" is a property name. Even if it works, it leads to confusing-looking code. Name your textfields descriptively, or at the very least something like "mytext" or "text1" or whatever.

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...
May 25, 2020 0