A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Navigation in Flash Player between clips (2nd post)

  1. #1
    Senior Member lukew's Avatar
    Join Date
    Aug 2001
    Location
    Montréal
    Posts
    217

    Navigation in Flash Player between clips (2nd post)

    Hi,

    I have a file in which a horizontal menu helps the user go from one section to another. Each section calls a movie clip to play on the main timeline. The main movie only has one frame.

    I would like to use back and next button so the user can view the last place he visited. This website is played entirely without using a browser (only plays with Flash player).

    Is there a way to have back and forward buttons in my movie?

    Newbie here

    Thanks,

    Luke
    Live for the moment (not in frames!)

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    You could certainly do this. I would create an array and each time a person clicked a button, you would pass the instance name of the appropriate clip into the array.

    Something like:

    Code:
    history=new Array();
    currentStep=0;
    
    function passInstance(instance){
      history.push(instance);
      currentStep++;
    }
    
    function back(){
      if(currentStep>0){
        currentStep--;
      }
    clipInstance=history[currentStep];
    clipInstance.gotoAndPlay(1);
    }
    That should get you started anyway.

  3. #3
    Senior Member lukew's Avatar
    Join Date
    Aug 2001
    Location
    Montréal
    Posts
    217

    Array

    Thanks for your reply. It helps.

    Where do I enter your code? on which button?

    Thanks,

    Luke
    Live for the moment (not in frames!)

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    The code I gave is for the first frame of the main timeline. Each button would say something like:

    Code:
    on(release){
    passInstance("movie1");
    }
    You could even extend the passInstance function so it told the proper clip to play as well as track the progress.

  5. #5
    Senior Member lukew's Avatar
    Join Date
    Aug 2001
    Location
    Montréal
    Posts
    217
    In other words. I would have two buttons (back and forward) that I would place on the stage with those instructions (script). The user would select from another menu, what he wants to see (by clicking on button which would call a movieclip). This clip (clipX) would play then when the user presses the back button, he would go back to the place he was before.

    so back button:
    on(release){
    passInstance("movie1");

    foward button:
    on(release){
    passInstance("clipX");

    Is this correct?

    Thanks
    Live for the moment (not in frames!)

  6. #6
    Senior Member lukew's Avatar
    Join Date
    Aug 2001
    Location
    Montréal
    Posts
    217

    Pass instance

    How would you create the code for passing and playing the instances?

    on my button I have written:

    on(release){
    passInstance("panel.swf");
    holder.play();
    }

    it works when I have just started the movie playing but once I have clicked other menu buttons (say "products"), the back button does not return me to the previous movie clip.

    also, should my code include the name of all my clips and if so, how do you list them? passInstance("panel.swf", "products.swf", etc.)?

    Many thanks,

    LUke
    Live for the moment (not in frames!)

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