views:

45

answers:

2

Just wanted to know what the best way of transitioning between pages in flash. Basically i have 5 pages, each of them have an intro animation (slide in, slide out). I know how to make them transition IN but say they click on some random page out of the 5 how do i transition out of the current page then somehow tell it to go to the one the user selected?

This is timeline based.

Any help appreciated, thank you.

+1  A: 

When you're using the timeline, you can label specific keyframes on the timeline and jump to them using some straightforward ActionScript.

gotoAndPlay("LabelName");

In that way you can setup an area on the timeline for each page in three parts per page (intro, page loop/stopped page frame, exit). If you label each, you can jump to the intro of a given section and have it animate into the page loop/stopped page area. When you want to go elsewhere, you proceed to the animate out label and then to the animate in label for the selected section.

Tegeril
Your answer seem like it will work but i still dont understand how you will know which frame or page im on. Suppose im on some arbitrary page X on its STOP position as you suggested, and i need to go to Y. Well first i would need to tell my function, hey you are on X, play its EXIT section then proceed to play Y. Buy how do i get the "label" of the current frame?
1337holiday
Well, depending on how you set it up, you don't need to know the label. If each section is setup lined up intro/main/exit, when you stop on the last frame of main, all you have to do to exit is tell the timeline to play(); and it will play right into the exit. Otherwise, http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/MovieClip.html MovieClip defines a currentLabel property, the timeline also has this property. I think you can just say this.currentLabel, though I haven't done much label/timeline related development in a while.
Tegeril
THanks bro looks like i will use a combination of these answers, setting 3 labels for each page seems like the best way.
1337holiday
+1  A: 

You will need to have a clickedPage variable which is set when the user clicks on a specific page.

Then you'll have a currentPage variable, if the clickedPage value is different from the currentPage go to the currentPage animation out frame.

At the end of the animation , update the currentPage value with the clickedPage value and start the animation in

PatrickS
This was the initial idea i had too, guess this will have to do. Thanks :)
1337holiday