Whats wrong with this?Code:onClipEvent(enterFrame){
if(this.hitTest(_root.targe-1)){
score += 10;
}
}
I want it to add 10 to Var "score" when it hits "targe-1"...
Printable View
Whats wrong with this?Code:onClipEvent(enterFrame){
if(this.hitTest(_root.targe-1)){
score += 10;
}
}
I want it to add 10 to Var "score" when it hits "targe-1"...
My guess would be that it's not reading 'targe-1' correctly... probably interpreting it as targe minus one. Not sure, though.
Okay, thanks..
onClipEvent(enterFrame){
if(this.hitTest(_root.targe1)){
_root.score += 1;
}
}
This is my script now, but it adds up 1+1+1+1+1=11111, insteed of 1+1+1+1+1=5 as i need...
Whats wrong?
You probably have to define _root.score as a Number; it seems to be interpreting it as a string.
Try
code:
Number(_root.score) += 1;
instead.
That didnt work, errors..
Ah, I see. I tried it out and I got the same error; apparently Number() can't be on the left side of an equation... it works if you type it this way, however.
code:
_root.score = Number(_root.score) + 1;
at the beginning of your code put:
var scrore:Number = 0
that way when you use the score varirable Flash will know that its a number instead of a string
Thanks Dude!
No problem.:)