Solved

Flash script - go forward or backward 24 frames

Posted on 2009-03-30
10
483 Views
Last Modified: 2013-11-11
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
Comment
Question by:sl1nger
  • 5
  • 5
10 Comments
 
LVL 19

Expert Comment

by:quizengine
ID: 24020968
See attached file - msg me if it doesn't make sense.
frame-jumper-cs3.fla.jpg
0
 

Author Comment

by:sl1nger
ID: 24021276
your setting the current frame to one and then using the gotoAndStop + or - 25.   Is that the only way to do this?
0
 
LVL 19

Expert Comment

by:quizengine
ID: 24021506
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
 

Author Comment

by:sl1nger
ID: 24025347
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
 
LVL 19

Expert Comment

by:quizengine
ID: 24026373
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:sl1nger
ID: 24043992
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
 
LVL 19

Expert Comment

by:quizengine
ID: 24044756
I'm sorry but I don't understand what you are asking
0
 

Author Comment

by:sl1nger
ID: 24045259
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
 

Author Comment

by:sl1nger
ID: 24056274
How do you say between in action script?
0
 
LVL 19

Accepted Solution

by:
quizengine earned 500 total points
ID: 24057337
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Action Script coding 1 173
Open Source MP4 Flash Player 2 169
Firefox fullscreen video lags 4 155
Shockwave Flash Object within PowerPoint 2013 2 114
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now