Groups | Blog | Home
all groups > flash actionscript > june 2004 >

flash actionscript : Key.isDown(0)



freez
6/26/2004 9:58:19 PM
Hi,

I have a Button which should play the current scene backward, while the
mouse Button is pushed. I red, that "Key.isDown(0)" returns true if the
mouse Button is pushed. But I tried it and it doesn´t work. If I type
"trace(Key.getCode)" it displays "0". Why doesn´t work it? I work on an
Mac with mx 2004.

Thanx freez

p.s. this is the ActionScript for the Button I used

on (press){
while(Key.isDown(0)){
prevFrame();
}
}
Shinchi
6/27/2004 1:49:06 AM
Hi, you can try this, I tried it out and it works. Instead of putting the codes
directly on the button, try putting it on the timeline. In this case, my_btn is
your button name.

var ispress:Boolean = false;
my_btn.onPress = function()
{
ispress = true
}
my_btn.onRelease = function()
{
ispress = false
}

onEnterFrame = function()
{
if(ispress)
{
gotoAndStop(prevFrame());
}
}
freez
6/27/2004 3:29:35 PM
[quoted text, click to view]

thanx
Shinchi
7/3/2004 5:43:07 AM
AddThis Social Bookmark Button