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

flash actionscript : Problem with gotoAndPlay


NSurveyor
11/21/2004 5:42:41 PM
The problem is, the onKeyDown is contiuously invoked while the key is down. So,
it keeps doing gottoAndPlay(44) over and over. Try something like:

Listener = new Object();
Listener.onKeyDown = function () {
if(Key.isDown(37))
if(isClicked!=true){
gotoAndPlay (44);
}
isClicked = true;
}
Listener.onKeyUp = function () {
isClicked = false;
gotoAndStop(1);
}
Key.addListener(Listener);
Rainer
11/21/2004 6:13:44 PM
Hello,

i have a problem with this script for a little animation which i want to
control with the arrow keys.

Listener = new Object();
Listener.onKeyDown = function () {
if(Key.isDown(37))
Play ();
}
Listener.onKeyUp = function () {
gotoAndStop(1);
}
Key.addListener(Listener);


This works perfectly.
But when i want the animation to start on another frame, i try this script:



Listener = new Object();
Listener.onKeyDown = function () {
if(Key.isDown(37))
gotoAndPlay (44);
}
Listener.onKeyUp = function () {
gotoAndStop(1);
}
Key.addListener(Listener);


The problem is, the animation starts at Frame 44 as it should, but then it
stops after a few frames (and gets stuck at frame 44).
Is this because of the key-repetition when i keep pressing it?
Why does it work with "play" and not with "gotoanplay"?

Any solutions?

Thank You.

NSurveyor
11/21/2004 6:25:45 PM
Jeckyl
11/22/2004 9:23:07 AM
eh?

AddThis Social Bookmark Button