Reverse play

how do i make the timeline play back and forth as well as in a loop?

Leanne:sigh:

ya need to do it with a bit of code:

in the first frame:


if(!Check) {
          Check = true;
          this.onEnterFrame = function() {
                    if(Reverse) {
                              this.prevFrame();
                    }else {
                              this.nextFrame();
                    }
                    if(this._currentframe == 1) {
                              Reverse = false;
                    }
                    if(this._currentframe == this._totalframes) {
                              Reverse = true;
                    }
          }
}

I have an idea for this. Take the bunch of frames you have;copy them, paste them infront of your other frames,highlight the newly pasted frames and right click, then select:Reverse Frames. And the on the last frame of the whole movie put in the
gotoandplay(w/e) script to make it go back to the desired frame.

If you need any help, ask.


movieclip.d = 1;
movieclip.stop();
movieclip.onEnterFrame = function() {
	this.d ? this.nextFrame() : this.prevFrame();
	if (this._currentframe == this._totalframes) {
		this._currentframe = this._totalframes-1;
		this.d = 0;
	}
	if (this._currentframe == 1) {
		this._currentframe = 2;
		this.d = 1;
	}
};

Dear m_andrews808,

Code is cool. I am using this for my preloader, however when i typed your code in it runs thru the entire .swf.

How do i do it so it only runs back and forth on preloader only?

Leanne X

you need to hard code a start frame and end frame where the movie will loop through:


if(!Check) {
        Check = true;
        this.onEnterFrame = function() {
                if(Reverse) {
                        this.prevFrame();
                }
                if(!Reverse) {
                        this.nextFrame();
                }
                if(this._currentframe == 5) {
                        Reverse = false;
                }
                if(this._currentframe == 10) {
                        Reverse = true;
                }
        }
}

the above code for example will play back and fourth between frames 5 and 10. You’ll also need to tell the code to stop when the movie has finished loading. I’ve amended the above code to allow this, when the movie finishes loading you’ll need to add something like:

Reverse = “stopped”;

let me know how you get on

do i place ifFrameloaded etc before or after this code ?

On same frame or on another layer?

you can put
[AS]
if (_root.getBytesTotal() = _root.getBytesLoaded()) {
delete this.onEnterFrame;
}[/AS]
at the end of the code (before the last two brackets :wink: )

sweet! never knew you could delete clip events like that, thats made my day (sad I know)

put Phat’s code anywhere inside the this.onEnterFrame = function() block, you might want to add a gotoAndStop() or somthing too. If you want specifics, it’ll be quicker and easier if you post the fla

(-:

*Originally posted by m_andrews808 *
**sweet! never knew you could delete clip events like that, thats made my day (sad I know)
(-: **

I know how it feels :slight_smile: I was the happiest person on earth when I found out about [COLOR=darkblue][FONT=courier new]_currentframe[/FONT][/COLOR] :}

ok i have posted the .fla as this is a bit confusing as i still dont know where ifFrameloaded goes, or maybe the code your talking about does it too.

i cant seem to be able to post it. There is no browse function this end to attach my file.

?

are you replying through quick reply or through “post reply button”?

THANK YOU

HERE IT IS

THANK YOU

HERE IT IS

THANK YOU

HERE IT IS

THANK YOU

HERE IT IS

wow, your enthusiastic! :P:P

okay I’ve had a look at your fla, and this is what I’ve come up with. Say your movie started on frame 80:


if (!Check) {
	Check = true;
	this.onEnterFrame = function() {
		if (Reverse) {
			this.prevFrame();
		}
		if (!Reverse) {
			this.nextFrame();
		}
		if (this._currentframe == 1) {
			Reverse = false;
		}
		if (this._currentframe == 75) {
			Reverse = true;
		}
		if(this.getBytesLoaded() == this.getBytesTotal()) {
			gotoAndStop(80);
			delete this.onEnterFrame;
		}
	}
}

should do the job for you. Of course you need to alter the gotoAndStop command to suit your needs