flsg -> RE: Flash Q&A thread 2 ** checked everyday (4/7/2006 21:06:16)
|
Zoltan: I'll try to explain this clearly: _root.score.text is a textField, right? everything in a textField belong to the string datatype, even number(number datatype:1, 2, 32, 2.354...) and boolean(boolean datatype: true or false) so it's not a very good way to add number in a string, and it can cause problems, like this one: _root.score.text=10
_root.score.text+=20 you may think that _root.score.text is now 30, but you're wrong. in Flash, the string takes advantage when we use the "+" operator so now _root.score.text is "1020", which makes a big difference. what I suggest is that you put the score in a variable, myScore, that have a value of 0 (a number!), everytime the score changes, do myScore+=10 (10 is just an exemple, change the number if you want), then change the textField's value: _root.score.text=myScore number+number=number, string+number=string hope you understand[;)]
|
|
|
|