0

So I'm trying to program a game using flash, and it's my very first time and I can't get something to work. In the game, a ball will float across the screen and if you click on it you get 2 points. Except when I test it, the first time I click on the ball I get the letters 'eoceeeo' and if I click the ball again I get the letters 'eeoS'. The dynamic text is on a layer with the first frame having the AS of

var _root.score = 0;
gameScore.text = _root.score;

The dynamic text has a varible of _root.score and a name of gameScore The floating ball has the AS of

on(release) { _root.score+=2; _root.gameScore.text = _root.score; }
Kara
  • 6,115
  • 16
  • 50
  • 57

1 Answers1

0

If you click on your gameScore dynamic text field, you can scroll down to its Variable property and set that as _root.score. That way, you do not have to call gameScore.text = _root.score every time the score changes - it will simply update automatically.

Also, if you remove the var from in front of _root.score = 0, it will be easier for ActionScript to handle. Perhaps, you are casting the score variable as an integer, and the dynamic text field is having trouble displaying it as a string of characters. This can also be solved with String(_root.score) and score.toString().

That should make your code a bit less complex, and help for you to identity your random letters problem, which can't be solved specifically with the information you have here. Hope that helps!

interpolack
  • 876
  • 10
  • 26