Copy link to clipboard
Copied
Hi, I'm using the script below to isolate specific keys on the keyboard to control the timeline. This works for a while but seems unstable. It causes Flash Player Debugger to run slow and eventually hang and I have to force quit the player.
Any suggestions to help to improve would be grateful.
stop ();
var keyListener = new Object();
Key.addListener(keyListener);
keyListener.onKeyDown = function ()
{
if (Key.getAscii() == 8)
{
gotoAndStop(7);
} // end if
};
Copy link to clipboard
Copied
try:
stop ();
var alreadyExecuted:Boolean;
if(!alreadyExecuted){
alreadyExecuted=true;
var keyListener = new Object();
Key.addListener(keyListener);
keyListener.onKeyDown = function ()
{
if (Key.getAscii() == 8)
{
gotoAndStop(7);
} // end if
};
}
Copy link to clipboard
Copied
Thanks kglad, this works well, but if I want to use the same script on the next frame and change the gotoAndStop to frame 8 the key press doesn't seem to work again?
Copy link to clipboard
Copied
you want the same keypress to goto frame 7 when the current frame is frame 1 and frame 8 if the current frame is frame 2. anything else?
Copy link to clipboard
Copied
The frames numbers don't need to be specific. The one I posted was something I was testing and that code just happened to start at frame 6 of my timeline.
Another example might make it clearer. If I start at frame 1 using that script, I want to stop at each frame ( 2-3-4-5-6-7-8-9-10 ) by using the delete key. Is the script you provided able to do that?
Copy link to clipboard
Copied
use:
stop ();
var alreadyExecuted:Boolean;
if(!alreadyExecuted){
alreadyExecuted=true;
var keyListener = new Object();
Key.addListener(keyListener);
keyListener.onKeyDown = function ()
{
if (Key.getAscii() == 8)
{
nextFrame();
} // end if
};
}
Copy link to clipboard
Copied
Thanks, will give it a try.
Copy link to clipboard
Copied
you're welcome.
p.s when using the adobe forums, please mark helpful/correct responses, if there are any.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now