# Scrolling back and forth on the timeline

**URL:** https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939
**Category:** Uncategorized
**Created:** [March 30, 2003, 1:34pm UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939 "2003-03-30T13:34:27Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![adfox](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@adfox](https://forum.kirupa.com/u/adfox)
#### Post date: [March 30, 2003, 1:34pm UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/1 "2003-03-30T13:34:27Z")

</div>

Hi,

I’m designing a page that is kind of like a photo album. You click on the next button to view the next image. The current image moves off to the left and the new one moves in from the right. Thats simple as its just sequential. But if i wanted to go back to the previous image in the same way with that one moving back to the right and the previous one moving back in from the left you obviously can’t make the timeline go backwards can you?

Can anyone help?? Thanks to anyone who can!

Andy

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 30, 2003, 2:27pm UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/2 "2003-03-30T14:27:32Z")

</div>

Howdy…

See if you can use this file… 😉

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 30, 2003, 3:14pm UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/3 "2003-03-30T15:14:49Z")

</div>

hummm,

thanks but I’m a bit of a jnr at actionscript. Either its not working or ive entered it wrong. can you not just put \_root this.back or something like that a bit like javascript??

help!! :crazy:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 30, 2003, 4:49pm UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/4 "2003-03-30T16:49:53Z")

</div>

Um… Sorry… Don’t quite understand what you meant by that… ☹

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 31, 2003, 4:33am UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/5 "2003-03-31T04:33:05Z")

</div>

Hi there…

to make the timeline go back and forth, yea you can use something like

on(release) {  
\_root.prevFrame();  
}

and similarly to go ahead in the frames,

u would use

on(release) {  
\_root.nextFrame ();

}

so basically u would assign each of these actions to the “previous” and “next” button respectively…  
and I believe that would do it…but if it doesn’t work or if u r confused…let me know…

oh…yea and if u want to go to a specific frame… u can also use

something like  
on (release) {  
\_root.gotoAndPlay (frame#);  
}

Good luck  
…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 31, 2003, 11:29am UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/6 "2003-03-31T11:29:09Z")

</div>

thanks for the script,

again my dimness has the better of me.

I pasted it into the actions window for the button and it doesnt seem to do anything. im sure there’s just an option you have to click on to make it work??

andy

ps check out this link it does something similar on the projects section…

[www.timdesign.co.uk](http://www.timdesign.co.uk)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 31, 2003, 5:19pm UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/7 "2003-03-31T17:19:47Z")

</div>

Hey Andy…

I haven’t really played around with this code yet, but basically u would need to do the following things…

1. make sure there is a keyframe (at the frame which u r moving back (or forth) to…)

2. If you need to have more spaces between the frames (i.e. u r doing any other animation or stuff) then its better to use the gotoAndPlay function and go to a specific frame (or different scene). to see how that works, go to the actions panel, type in gotoAndPlay, highlight it, click the reference button to find out more about the function.

If u r still stuck, and can’t get it to work, then just post the .fla and I’ll take a look at it and find out whats wrong…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 1, 2003, 1:09pm UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/8 "2003-04-01T13:09:48Z")

</div>

thats great!

Ive got a bit further it now moves to the prev. frame with

on(release) {  
\_root.nextFrame ();  
}

but it doesnt seem to work with the onrelease gotoandplay action.

Is this supposed to reverse the timeline kinda thing? cus thats what I want. I know how to make it go straight to a certain frame with the gotoandplay action but i wanted it to play back over the frames until it gets there. Know what i mean?

cheers for this help btw.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 1, 2003, 1:12pm UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/9 "2003-04-01T13:12:25Z")

</div>

…oh this is flash mx btw

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 3, 2003, 8:42am UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/10 "2003-04-03T08:42:52Z")

</div>

Can anyone else shed any light on this?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 3, 2003, 4:05pm UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/11 "2003-04-03T16:05:12Z")

</div>

hi there

I am confused as to what you want to do…it would be better if u could post the .fla so i know what u r trying to do…

gotoAndPlay doesn’t “reverse” the timeline, but it can go to a specific frame in the timelline…

oh…yea there is a tutorial on creating a photo gallery on kirupa, have u checked it out yet?

[http://www.kirupa.com/developer/mx/photogallery.htm](http://www.kirupa.com/developer/mx/photogallery.htm)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 4, 2003, 8:57am UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/12 "2003-04-04T08:57:25Z")

</div>

Don’t know how new you are to the program adfox, but be sure that you are placing those actions on your buttons. Sometimes we paste actions into the action script panel without realizing that flash has lost focus with an object or a frame. Misplaced code like on(release) won’t work anywhere but a button.

tipusultan is right though… if you can post a copy of the FLA file, preferably in zip format, it would be easier.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 5, 2003, 9:36am UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/13 "2003-04-05T09:36:53Z")

</div>

Hi,

Thanks everyone.

I’ve been using flash for about a year but i’m only just getting into actionscript.

I’ve posted a zipped version of one of the .fla files that needs the button. This already has the actions for the “next” button but I want the “prev” button to slide in the same way but back instead of forward. Obviously this one does’nt have any images on it but I want the same principal to apply for the other pages that do.

Yeah I’ve seen the photo album tutorial. I’m pretty sure I can do something similar. On that though the images fade in and out instead of back and forth, which is what I want.

Any help is always appreciated.

Fox

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 7, 2003, 6:15pm UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/14 "2003-04-07T18:15:34Z")

</div>

anyone else wanna have a go? cheers

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 7, 2003, 8:41pm UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/15 "2003-04-07T20:41:16Z")

</div>

i d/l your file and if i had time i would edit it but ive got too much work…  
the thing is:  
you are using tweens, its really hard to use tweens backward except if you put a layer full of frames that say gotoPreviousFrame

what i would do is put an AS that decrements the \_y pos of your text (movieclip) till it reaches a certain number, and increment the value for it to go up (ie loop the script so that the \_y pos goes up)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 7, 2003, 9:30pm UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/16 "2003-04-07T21:30:25Z")

</div>

hum, easier said than done whe youre a novice like me!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 9, 2003, 12:33am UTC](https://forum.kirupa.com/t/scrolling-back-and-forth-on-the-timeline/16939/17 "2003-04-09T00:33:49Z")

</div>

Hey

sorry buddy, i haven’t had the time to edit yur .fla yet, i am studying for an university exam (tomorrow)…  
but i did look at it…basically what u r doing wrong is those tweens, u can’t expect actionscript to make those tweens to go back…  
so basically one way of doing it would be remove those tweens and make the movieclip move with actionscript…

what milkdesign said was right, and i saw yur reply too, but i am pretty much a novice myself, and can’t think of the code right now… but once exam is over tomorrow, i will take a look at it, and i am sure if one of the flash gurus here see this msg, they will hopefully solve it for u

k… but to get u going, here r my thoughts …um…

for the next button  
on (release) {  
\_y = 0;  
speed = 4;  
endY = the Y value at which we can stop;  
\_y += (endY-\_y)/speed;  
}

and similarly for the previous button, we could simply replace the end statement with \_y += (endY- \_y)/speed;

i have no idea if this would work, but try it out, play around with it, and u know what, i could bet u that there is a tutorial for that…so if u can find one…

aight, good luck…later… i am back to studying…need to get an :A+:
