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
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
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.