|
-
Buttons clicked counter
Hiall,
I need a bit of help with actionscript.
Basically I have a kind of shoot the duck game I created, there are 8 ducks and each one have a button so when each duck is shot an ad comes up.
Now the client wants something to happen when all the ducks have been shot, so I created this bit of AS which I put in the main timeline.
var count;
function doCount(){
count++;
if (count >= 8){
gotoAndPlay ("goose");
}
}
On each of the buttons, the AS is:
on (press){
_parent.ducks1_mc.duck_7_mc.gotoAndPlay(2);
_parent.ducks2_mc.duck_7_mc.gotoAndPlay(2);
_root.promos_mc.promo_07_mc.gotoAndPlay(2);
_root.doCount();
bt_7.enabled = false;
}
But everytime I shoot one it goes to "goose" when I want it to go there only when all the ducks have been "shot".
hope someone could help me.
Cheers
-
Ryan Thomson
use a trace command to see if your count variable is working.
under 'count++;' put
trace(count);
should give you some answers
-
score for flash game
hello
i have designed a game with four buttons... which wen clicked score must increase in the dynamic score box.... i have used this script
on (release) {
score = Number((score))+50;
}
it is not working wen i click on the button at run time i get a msg " NAN " in the score box... wt should i do....
i also want the button to disappear wen clicked on it n score should be displayed
it will be great if someone would help me with this script
thank
-
Hi Ryan,
I've placed the trace in the place yu told me and the out put says NaN everytime i click or shoot a duck.
Bit lost here, cheers!
-
Ryan Thomson
That's a good thing! It means using trace worked because it's telling us that 'count' is not returning a number (NaN = Not a Number). To fix this change:
var count;
to
var count:Number = 1;
I'm thinking after you change that the trace will return a number
@kerinaonline - same problem, add var score:Number = 1; somewhere on your main timeline
-
Thanks Ryan,
I'll try it out tonight and will keep you posted.
Cheers,
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|