flsg -> RE: Flash Q&A thread 2 ** checked everyday (4/25/2006 16:35:23)
|
darklord517: OMG, didn't you read the thing in my last post? It was for you[&:] quote:
ORIGINAL: flsg 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 swenn: I thought about the code, and you should replace it with: function handFunc(){ this.gotoAndPlay(40) } mc1.onRelease=mc2.onRelease=handFunc remember, don't add the () after handFunc, since it's a reference we want, not a return value
|
|
|
|