Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Loop Back And Forth

New Here ,
May 26, 2006 May 26, 2006
I have done some searching on this and other sites, but still can't seem to find a play backwards command. I have used the gotoAndPlay command for looping smaller sections of a movie, but this is a morph and I would like loop back and forth.
TOPICS
ActionScript
659
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 26, 2006 May 26, 2006
If the entire movie is to be played back and forth... place this code on Frame 1:

onEnterFrame = function () {
dir ? prevFrame() : nextFrame();
_currentframe == 1 || _currentframe == _totalframes ? dir ^= 1 : null;
};

Basically, this code is run continuously. In the beginning dir is undefined, and in a conditional, that is basically false, so it goes to nextFrame(). This keeps happening until _currentframe is equal to _totalframes. When this happens, dir = dir^1. The nice thing about ^, is that: undefined^1=1, 0^1=1, 1^1=0. So, when dir is equal to undefined or 0, when the frame reaches the _totalframes limit, it will automatically switch to 1, telling the movie to play backwards as seen in the first condition. And then, when it reaches frame 1, dir becomes 0. This repeats on and on and on....
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 28, 2006 May 28, 2006
I over though on the ^ idea. Simply dir=!dir works and it makes much more sense.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 29, 2006 May 29, 2006
Do you want to play the entire movie back and forth, or just sections of it?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 29, 2006 May 29, 2006
Just sections of it.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 31, 2006 May 31, 2006
LATEST
I've created a little movieclip to illustrate a system of playing backwards and forwards:
http://cristancho.net/flash/playBackward/

If this looks like it may be helpful to you, then you can download the FLA here:
http://cristancho.net/flash/playBackward/backwardTimeline.zip

Hope this helps...

Albee
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines