count clicks using actionscript 3.0 in flash
Posted
by Michael Stone
on Stack Overflow
See other posts from Stack Overflow
or by Michael Stone
Published on 2010-03-17T04:52:28Z
Indexed on
2010/03/17
5:01 UTC
Read the original article
Hit count: 375
actionscript-3
|flash-cs4
I want to change the variable value based on the number of clicks.
So if you click the button once, the cCount should equal 1 and twice it should equal 2.
Right now all I'm returning for the value is 0, no matter the amount of clicks.
Any ideas?
btnRaw.addEventListener(MouseEvent.CLICK, flip);
btnRaw.addEventListener(MouseEvent.MOUSE_UP,count);
//create the flipping function
//create the variable to store the click count
var cCount:Number = 0;
function flip(Event:MouseEvent):void{
raw_patty_mc.gotoAndPlay(1);
}
function count(Event:MouseEvent):void{
cCount = cCount+1;
if(cCount>3 || cCount<6){
titleText.text="See you're doing a great job at flipping the burger! "+String(cCount);
}
}
© Stack Overflow or respective owner