Change textField's Text Property in AS3 Flash CS5.5

techy_06

Distinguished
Aug 9, 2010
17
0
18,560
Hey Everyone,

I have a textField in my scene named currentScore. Every time the player shoots an enemy, I update this field to show the new score. The problem is, whenever I try to update the text, its not showing the new number.

When I start the game:

currentScore = "Score: " + score;
and the text field shows "Score: 0";

When an enemy is killed:
currentScore = "Score: " + score;
and the text field shows "Score: ";

I have currentScore set to dynamic text, single line, Verdana, 15pt font.

This same code works in Flash CS4, but when i do it in CS5.5, i get nothin.

Any ideas?


P.S. I print the score to the console, and the score has the proper number, so it is not as if score suddenly became null.
 

techy_06

Distinguished
Aug 9, 2010
17
0
18,560
Oh, my mistake. I am using text.

When I start the game:
currentScore.text = "Score: " + score;
and the text field shows "Score: 0";

When an enemy is killed:
currentScore.text = "Score: " + score;
and the text field shows "Score: ";

I have also tried:
currentScore.text = "Score: " + score.toString();
and
currentScore.text = "Score: " + String(score);

with no success
 

Rusting In Peace

Distinguished
Jul 2, 2009
312
0
19,060
Score will automatically be converted into a string. There is no need to cast it.

I think you'd need to post your code for me to help you fully.

Can you debug and add breakpoints with CS5.5? I come from the Flex Builder side of Flash/ AS3 you see. I guess you're using CS5.5 because you are doing more graphical work than programming?
 

techy_06

Distinguished
Aug 9, 2010
17
0
18,560
Ok. Sorry for my lack of communication but I figured out the problem. The problem was that the font in the label was set to a "bitmap font". I changed this option to "use device fonts" and it is working properly now. No action script code needed to change. If you are having a similar problem, just select the textfield, and in properties on the right, select use device fonts. Thanks for your help rusting in peace!