PDA

View Full Version : How to Count mouse clicks?


ebz
12-22-2001, 04:37 PM
Hi

Ok, i have this guy (see picture) and when you click at him he zaps at the TV.
But nothing happens. Only after clicking a lot of times or by clicking very fast hes head explodes, only leaving some smoke...

so how can i do that?

1) How do i count the number of times clicked on fx. object A and when its more than X times then it should go to frame B.

and...

2) Is it possible to count double clicks or trible clicks? So fx. if there is a double clik on objekt A then go to frame B.

Please help :confused:

jimburton
12-22-2001, 09:18 PM
so the chap's a button and on him the code:

on(release)
{
clicked();
}

and on the first frame you have the code:

numClicks = 0;

function clicked()
{
numClicks++;//add one to numClicks
if (numClicks >= 5)
{
//go to next scene or whatever
}
}

to register double-clickes have a look at the following thread - http://www.actionscript.org/forums/showthread.php3?s=&threadid=7670

ebz
12-22-2001, 09:44 PM
Thanks jim !! I'll try it ......

ebz :)

ebz
12-22-2001, 10:12 PM
Ok im maybe really stupid but it doesnt seem to work. Did you meen like this:

numClicks = 0;
function clicked () {
numClicks++;
// add one to numClicks
if (numClicks>=5) {
// go to next scene or whatever
}
}
gotoAndPlay (45);


- and it should be in the first frame in the scene, and in any frame right?

ebz :confused:

Billy T
12-22-2001, 11:46 PM
worked fine for me

maybe your gotoAndPlay is in the wrong place (should be above the }})

and yeah just place the function the first frame

ebz
01-02-2002, 03:02 PM
Ok it works ... thanks a lot folks!