Jumping to key frames

  • alshifman
  • Born
  • Born
  • alshifman
  • Posts: 2

Post 3+ Months Ago

I am trying to create a jump forward button, that will direct the user to a specific keyframe in the timeline. This is for a training CD, and the keyframes correspond to where mp3 files begin (which seperate sections). I am having a lot of trouble figuring out the easiest way to do this.

My last try was to label these key frames with a similar chain, (1, 11, 111, 1111, 11111) and the code the button to read:

gotoAndPlay(_currentframe +"1");

This is not working, as it reads the current frame number, not the frame label, and then just adds a literal one. Any ideas?

  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

You can't frame label your frames with numbers. You can incorporate a number into it, but it cannot start with a number, or contain just numbers.

_currentframe as you found out does read the current frames numbers. So far Macromedia has not put in a way to read a frame label through AS.

Your options are a bit slim, and i'm sure I will be missing some options since i'm in a bit of a rush, but here I go.

If it's possible, you may have to hard code the button actions to go where you want.

Or (just theory, didn't test) you can store the frame labels/numbers in an array then use that. For example.....

Frame 1 actions will contain...
Code: [ Select ]
var index;
var frames = ["keyframe2", "keyframe3", "keyframe4"];
  1. var index;
  2. var frames = ["keyframe2", "keyframe3", "keyframe4"];

You will notice I start at keyframe2, this is because your movie starts playing at keyframe1, so theres no need for it in there.

Then on each keyframe you can add an
Code: [ Select ]
which is like saying index = index+1 (increments the variable "index" by 1).

You can then use the index variable to check your array for what keyframe is coming up, then use a gotoAndPlay() to go to it. Something like...
Code: [ Select ]

If this doesn't help, hopefully it's a point in the right direction.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 6 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.