If currently not on this frame, play this exit

hi, i’ve got a problem with my actionscripting part
i want to create an “exit” effect just like many sites i’ve seen
it goes somewhat like this structure:
page 1:
intro animation
main page
exit animation

          page 2:
          intro animation
          main page
          exit animation
          
          page 3:
          intro animation
          main page
          exit animation

ok, now there will be 3 buttons, to bring u to the respective pages.
the prob is, how do i run the exit animation for the page i’m currently in, when i click on another button that doesnt not link to my current page?
like e.g
i’m in page 1
when i click on page 3’s button, it will play page 1’s exit animation
then it will play page 3’s intro animation
i’m thinking of a code like

if (_root.currentFrame != 1) {
playThatFrame’sExitAnimation
}

this will be placed on the button itself… i cant attach a .fla file as i have no idea how to do it… thanx in advance