This content has been marked as final. Show 8 replies
How could I set up ActionScript so that the user can type in a 2 or 3 digit # and then hit enter to jump to that correspondnig frame?
Right now I have the AS on a button that is on every frame, but off the stage and out of view when the swf is published.
I really appreciate any help.
use a variable to store the previous key press and take the appropriate action based on the previous and current. you can add a time element to ensure the keypresses occurred within a certain time span.
Thanks, that sounds like it might work.
I am new to actionscripting, so I don't know how to add a time element to allow the recording of 2 keystrokes, though. If you have time, can you provide an example.
I'll search for what you described up in the mean time.
Thank you for taking the time to help me.
I tried your AS on the button I was using in frame 1, and then tried various things once it didn't work. I couldn't add it to the button I was using, so I tried it on frame 1, in an Actions layer; still nothing. I tried different targets too, but to no avail.
I searched for lastKeyCode and prevKeyPressTime but didn't find any information on those scripts.
that code should be attached to a frame and will check if a 2 key is followed by 1 within 300 milliseconds.
I traced the timer and it works nicely, but for some reason I cannot jump to frame 21. I tried the 2 (50) and 1 (49) keys on the keyboard in addition to the #pad, and still nothing. I made the whole thing a movie clip, and placed it in one frame upon which I tried your code (after changing the target), and it still didn't jump to frame 21.
Thanks for your additional help.
that's a bad reference to "this" (which is going to be the listener object). use: