[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 492
  • Last Modified:

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.
0
sl1nger
Asked:
sl1nger
  • 5
  • 5
1 Solution
 
quizengineCommented:
See attached file - msg me if it doesn't make sense.
frame-jumper-cs3.fla.jpg
0
 
sl1ngerAuthor Commented:
your setting the current frame to one and then using the gotoAndStop + or - 25.   Is that the only way to do this?
0
 
quizengineCommented:
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 ?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
sl1ngerAuthor Commented:
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.  
0
 
quizengineCommented:
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)
0
 
sl1ngerAuthor Commented:
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??
0
 
quizengineCommented:
I'm sorry but I don't understand what you are asking
0
 
sl1ngerAuthor Commented:
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.
0
 
sl1ngerAuthor Commented:
How do you say between in action script?
0
 
quizengineCommented:
There is no 'between' feature. Instead try this

      if (current_frame >= 1) {
            if (current_frame <= 24) {
                  current_frame = 72;
            }
      }
      if (current_frame >= 25) {
            if (current_frame <= 48) {
                  current_frame = 24;
            }
      }
      if (current_frame >= 49) {
            if (current_frame <= 72) {
                  current_frame = 48;
            }
      }
      gotoAndStop(current_frame);

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now