Avatar of sousflai
sousflai
 asked on

how to assign goto next frame action with a space bar press

Within a movie clip I've made some stop markers. At these points I'd like the space bar to make the timeline move to the next frame and initiate a new animation. It sounds easy but for some reason nothing seems to work, thanks in advance
steve
Adobe Flash

Avatar of undefined
Last Comment
SamuelRostol

8/22/2022 - Mon
Montoya

keyListener.onKeyDown = function() {
    if (Key.isDown(Key.SPACE)) {
       

                                 trace('space was pressed'); //or whatever code you want
            myMovie.gotoAndPlay(nextFrame);   //or whatever code you want



    }
};
Key.addListener(keyListener);



sousflai

ASKER
I want to control timelines within movie clips, should I use this code on the main timeline or in the frame that I want it to be active. I should explain more. I have stop actions through various movie clips which I want the keppress of space to advance to the next frame. The problem is that at the final stop in a movie clip I want space to tell the main timeline to advance to the next frame where a new movie clip is waiting. Would your code assign the space bar a global function? or would it only affect the frame in which it is written in which case I can manualy change the result of the press?

many thanks Steve
sousflai

ASKER
I've tried using the code inside the movie clips timeline so that it knows not to disrupt the main timeline but unfortunatly it doesnt work

any ideas?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
sousflai

ASKER
this code works


.on (keyPress "<SPACE>") {nextFrame();

}

but only on the main stage and not in movie clips otherwise it would solve my problem
ASKER CERTIFIED SOLUTION
SamuelRostol

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question