Scrolling back and forth on the timeline

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

Howdy…

See if you can use this file… :wink:

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:

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

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

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

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…

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.

…oh this is flash mx btw

Can anyone else shed any light on this?

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

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.

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

anyone else wanna have a go? cheers

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)

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

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+: