all groups > flash actionscript > april 2004 >
You're in the

flash actionscript

group:

Button press detect


Button press detect Dinghus
4/30/2004 11:27:01 PM
flash actionscript: Maybe it is because it is Friday and been a long week, but this one is toasting
my brain.

I am trying to figure out how to do an action continually while a button is
pressed. I figured out how to do it with an on (press) sending it to a
function that just loops and then when the on (release) sends it to another
function basically ending the loop, but I would think there is a button
property that tells that the button is still depressed or not that I could loop
on with a "while button pressed" command.

Am I missing it or is it really not available.
Re: Button press detect JPI
4/30/2004 11:42:14 PM
How about....
if (Key.isDown(THEKEY))
{
do Something
}
Re: Button press detect Jack.
5/1/2004 11:31:35 AM
set up a function to control the loop dependant on
the state (0/1) of a variable passed to the function,

//timeline script
function looper(x){
this.onEnterFrame = function(){
if(x==1){
// looping actionscript
} else {
delete this.onEnterFrame;
}
};
};

//button script
on(press){ looper(1); }
on(release){ looper(0); }

hth

AddThis Social Bookmark Button