Link to home
Start Free TrialLog in
Avatar of sl1nger
sl1nger

asked on

Flash script - go forward or backward 24 frames

I have a forward button and a back button.

when the user clicks the forward button, I'd like the timeline to jump 24 frames.   I'm trying to do this in the action script.
Avatar of quizengine
quizengine
Flag of United Kingdom of Great Britain and Northern Ireland image

See attached file - msg me if it doesn't make sense.
frame-jumper-cs3.fla.jpg
Avatar of sl1nger
sl1nger

ASKER

your setting the current frame to one and then using the gotoAndStop + or - 25.   Is that the only way to do this?
I can think of lots of more complicated ways of doing it, but none so easy.

Is there a reason why this won't work for you ? Is there something else to be taken into account that I don't know about, that would make this solution unsuitable ?
Avatar of sl1nger

ASKER

The total number of frames in my movie is at 72. If I hit forward when the movie is on frame 68, this would take me  to frame 92. Instead, I'd like for it to count, go back to the start, and count the remaining.  Then lead us to frame 20.  
then add the code to the + button

if (current_frame > 72) {
     current_frame = current_frame - 72
}

and if you want similar behaviour on the - button add the code

if (current_frame < 1) {
     current_frame = current_frame + 72
}

(I think I used the variable 'current_frame' - if I didn't, just substitute the name of the variable I actually ised)
Avatar of sl1nger

ASKER

Ok.  I'm understand better now.

Can you assist me in this syntax for back button?

on (release) {
      stop();
      if (current_frame between 1 and 24) {
      current_frame = 72;
      }else if (current_frame between 49 and 72) {
      current_frame = 48;
      }else if (current_frame between 25 and 48) {
      current_frame = 24;
      }
      gotoAndStop(current_frame);
}

This is what I have in the script layer, first frame -- var current_frame = 1;   How does it know to increment on each frame??
I'm sorry but I don't understand what you are asking
Avatar of sl1nger

ASKER

I'm new to action script.  I just need to know how close I am on the code.  I put in what needs to happen, but get errors when I save this.
Avatar of sl1nger

ASKER

How do you say between in action script?
ASKER CERTIFIED SOLUTION
Avatar of quizengine
quizengine
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial