PDA

View Full Version : double press


watermelon
12-16-2001, 02:55 AM
how can i make it so if i double press the right button i can add an acton.

jimburton
12-16-2001, 03:14 PM
don't know if there's a neater way to do this (something tells me there may be!) but you could do:

on (release)
{
if (clickedOnce)
{
//do dblclick stuff
clickedOnce = false;
}
else{clickedOnce=true;}
}

this works, but it works for two entirely separate clicks too - you might need to add a timer to check that the user has clicked twice within an allotted time - check tutorial on delaying events for info on that.

jimburton
12-16-2001, 03:20 PM
I was being lazy mate, here's it with the timer!

on (release)
{
if (clickedOnce)
{

secondClick = getTimer();
if(secondClick <= (firstClick + 1000))
{
trace("doubleclick!");
}
clickedOnce = false;
}
else{clickedOnce=true;
firstClick = getTimer();}
}

watermelon
12-16-2001, 10:13 PM
no i need it for a double keypress on a button EG. the left and right keys, not a mouse click.

Ricod
12-17-2001, 09:07 AM
Its the same. Just replace on(release){ with :
on (keypress "k"){
replace "k" with whatever your going to use.

jwalton
02-17-2004, 01:26 PM
hmm.. seems a bit complex? not surte why we need the if(clickedonce) thing... here's one i am using:



on (press) {
previousClickTime = clickTime;
clickTime = getTimer();
clickSpeed = 500;
if (clickTime <= (previousClickTime + clickSpeed)) {
trace("double-click");
// do double-clicky things
} else {
trace("single click");
// do single-clicky things i.e. select
}
}

splict
02-17-2004, 01:51 PM
Originally posted by jwalton
hmm.. seems a bit complex? not surte why we need the if(clickedonce) thing... here's one i am using:

because if you triple click yours it will show up as two double-clicks.

tg
02-17-2004, 02:09 PM
besides.... this is a really old thread, and none of the suggestions work, because the original question is for the 'right' mouse button, which no matter how many times you click it will just give you the popup menu. hehhehheh.

splict
02-17-2004, 02:15 PM
i saw it was an old thread, but I just posted a response in case someone searched it. I didn't even read the first post where it said 'right-click' :o

jra
09-06-2005, 11:25 AM
because if you triple click yours it will show up as two double-clicks.

Try this one.... triple-click-fixed...
on (press) {
previousClickTime = clickTime;
clickTime = getTimer();
clickSpeed = 500;
if ((clickTime<=(previousClickTime+clickSpeed)) && firstclick == false) {
firstclick = true;
trace("double-click");
// do double-clicky things
} else {
firstclick = false;
trace("single click");
// do single-clicky things i.e. select
}
}