00:00
00:00
Newgrounds Background Image Theme

SevsArtCave 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!

Desable clicking repedadly

602 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.