00:00
00:00
Newgrounds Background Image Theme

Boayne98 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Foss: Double Click

1,622 Views | 4 Replies
New Topic Respond to this Topic

Foss: Double Click 2005-08-27 21:39:17


Here's a script to check if you have double clicked on an object (movieclip, button, etc)

Add this to your main timeline:

Object.prototype.checkDoubleClick = function() {
var cond = this.lastClick ? getTimer()-this.lastClick<300 ? true : false : false
this.lastClick=getTimer()
return cond
}

Now you just call it from the object you want to. For example, a button:

on(release) {
if(this.checkDoubleClick()) {
trace("Double Click")
}
}

I was bored, and I havn't got any AS or FOSS threads out there, so i thought i'd help people out with a simple solution to checking for double clicks

Response to Foss: Double Click 2005-08-27 22:05:35


could you do one for a double button press? like for attack combos in a game?


BBS Signature

Response to Foss: Double Click 2005-08-27 23:03:35


meh <3 binary!!

Object.prototype.checkDoubleClick = function() {
var cond = this.lastClick && getTimer()-this.lastClick<300;
this.lastClick = getTimer();
return cond;
};

Response to Foss: Double Click 2005-08-27 23:22:27


sorry for double post but i gues he's not gonna answer it

onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE) && !hit) {
hit = true;
if (lastPress && getTimer()-lastPress<500) {
trace("omg");
}
lastPress = getTimer();
} else if (!Key.isDown(Key.SPACE)) {
hit = false;
}
}

Response to Foss: Double Click 2005-08-30 17:41:28


Just got back from my vacation. Thought i'd bump this


wtfbbqhax