00:00
00:00
Newgrounds Background Image Theme
Upgrade Your Account!

HO HO HOPE you become a Newgrounds Supporter this year!

We're working hard to give you the best site possible, but we have bills to pay and community support is vital to keep things going and growing. Thank you for considering!

Become a Supporter so NG can see another Christmas!

Desable clicking repedadly

606 Views | 6 Replies
New Topic Respond to this Topic

Desable clicking repedadly 2008-04-29 13:37:29


Can some one tell me a code to desable clicking repedadly for a costume cursor.
Exeple:You have cursor that is a pistol/rifle/knife and when you click the cursor plays his frames.
But there is a problem that if you click repedadly the plays his fremes repedadly too.
So I want that if you shoot one time you will have to wait one second until you can shoot again.

I hope I make eny sance.

Thanks.

Response to Desable clicking repedadly 2008-04-29 13:40:18


I can tell English isn't your first language. Not bad, though.

Are you using code to perform this 'shooting' or do you have a button in flash you are pressing?

If you are using code can you post it?

Response to Desable clicking repedadly 2008-04-29 14:05:43


Here is the code:

onClipEvent (load) {
startDrag("_root.aimer", true);
}
onClipEvent (mouseDown) {
_root.aimer.gotoAndPlay(2);
}

Response to Desable clicking repedadly 2008-04-29 14:10:47


Just check if the current frame is the cursor (I'm guessing the first frame):

if (_currentframe == 1) { // play animation }

They used to call me souled...

Response to Desable clicking repedadly 2008-04-29 14:46:15


var readyToShoot:Boolean=true; function wait(){ trace("waiting..."); /*you can fire again*/ readyToShoot=true; } onMouseDown=function(){ if(readyToShoot==true){ readyToShoot=false; shoot= setInterval(wait 1000); } }

give this a try

Response to Desable clicking repedadly 2008-04-29 14:48:17


At 4/29/08 02:46 PM, zenyara wrote:

WOops forgot to clear the interval...

use this instead.

var readyToShoot:Boolean=true;
function wait(){

clearInterval(shoot);

/*you can fire again*/

readyToShoot=true;

}
onMouseDown=function(){
if(readyToShoot==true){
trace("waiting...");
readyToShoot=false;
shoot= setInterval(wait 1000);
}
}

give this a try

Response to Desable clicking repedadly 2008-05-01 07:10:22


Thanks for help but it doesn't work and i try on my own but i don't get it right.