Going back to last visited frame?
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Going back to last visited frame?

  1. #1
    Junior Member
    Join Date
    Feb 2006

    Going back to last visited frame?

    I'm working on a project that is completely non-linear, so you can be jumping from one frame to the other, and one scene to another. I would like a button on each page that will take you back to the frame that you've just come from. Obviously, "previous frame" won't work as that just takes you to the previous frame on the timeline. How would I go about first getting Flash to record what was the last frame was, and then calling this from a button?

    Thanks for your help in advance,

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    1 In the first frame of the movie, initialize an array which will hold all the interesting frames that were visited:
    navStack = [];
    2 In each interesting frame, have a script add the current frame number to the list of interesting frames that were visited:
    3 Attach the following script to the button that sends the playback head past the most recent interesting frame to the previous interesting frame:
    on (release) {
       if (_root.navStack.length > 1) {
          recentFrame = _root.navStack.pop();
          previousFrame = _root.navStack.pop();
    How it works
    When the movie plays, an array called navStack is created, and each interesting frame adds itself to this array as it's played. When the button is pressed the script checks that there are enough bookmarks for meaningful navigation, then pops and discards the current starting point before jumping back to the previous interesting frame.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center