View Full Version : Jumping to frame labels

03-17-2007, 02:26 PM
I've been searching extensively for an answer to this and I'm beginning to think it may not be possible...

Is there a way to define the arrow keys on the keyboard to jump to the previous/next frame label? Note: not the next and previous frames, but the frames with labels attached only.

I have a video playlist with several items and I'd like the user to have the option of using the keyboard arrow keys to scroll up and down the list. I know how to use the on (keyPress) and gotoAndPlay functions, but I'd like to avoid having to enter the specific frame labels.


03-17-2007, 03:12 PM
I dont really understand why you need to use the labels at all. Do they fill any other purpose in the application?

03-17-2007, 03:23 PM
It's a video playlist and for each item listed, there's a unique graphic that accompanies it when selected. i.e. clicking item #1 on the playlist starts video #1 (via import mx.video.*) and jumps to frame label #1 (via gotoAndPlay) where there's a graphic item to display only for that particular video. And so on for the other playlist items. I'm probably taking the long way around...

03-17-2007, 04:08 PM
You can construct an array having your frame labels and write a function for the arrow keys to make it gotoAndPlay(labels[i]) on release.

03-17-2007, 05:44 PM
Thanks for your input Ali - I'm not that well-versed in ActionScript yet, so I'm trying to design this thing based on what my experience currently is.

It all works the way I want, until I got the notion to add keyboard navigation for the user.

I guess my first post should've given more detail: I'm using an external .as file to create the flvplayback components on-the-fly when the user clicks the video name (which is a button, linked to the .as file). There's also a lengthy if/else script that invokes the videos to play one after another in sequence. I'm almost certain the code (Key.isDown(KeyCode)) for keyboard navigation should go somewhere in there...


08-08-2007, 04:00 PM
You can construct an array having your frame labels and write a function for the arrow keys to make it gotoAndPlay(labels[i]) on release.

I'm wondering if I could use this for what i'm having trouble with. I'm making a presentation in flash with the arrow keys as navigation. I have it set up by section in my .fla I have an intro in the main timeline. After that, it stops at the last frame of the intro. On that frame, I have action script to then play a movie clip of the first section when the arrow key is pressed. Here is the code I used:
this.onKeyDown = function() {
if (Key.getCode() == (Key.RIGHT)) {
So each section of the presentation has it's own movie clip that is accessed with the same script. My problem now is that in one of the movie clips I want it to stop at a point and wait for the key to be pressed and then move on still within that movie clip. I tried putting the same script on the frame in the movie clip, but it didn't work.

OR... am I better off using the suggestion and creating frame labels? My boss wants to use this presentation in the future but with changing images. So I need it as simple as possible. Any help is GREATLY appreciated.