2 Replies Latest reply on Jan 2, 2011 7:31 AM by dropkick1

    gotoAndPlay() problem [ newb ]



      i'm a flash newbie, and working on a website.  i've created several  movie clips to be used as internal pages on the site, and a clip to be  used as a menu.  when i click on an item in the menu clip, i want  whatever page is currently displayed to disappear and a new subpage clip  to be displayed.

      i have things set up as follows.  in scene 1, i have the subpage movie  clips each in its own layer, starting in different frames, staggered  along the timeline [i.e., it looks kindof like a stair-step].  i have an actionscript layer, and i've placed a stop()  in the same frame numbers as the keyframes for each of the movieclips  [these are all in the one actionscript layer, not directly on top of the  movieclips].  i've named each of the keyframes where a subpage  movieclip starts.  i've set up the menu so that a button click will set a  global string variable w/the name of the movieclip to view next, then  allow whatever the current movieclip is to run to the end, clearing the  stage for the next clip.  the last action of the current clip is to stop  the playhead and call a _root function which does a  gotoAndPlay(movieclip) in scene 1, where 'movieclip' is the name of one  of the labels [e.g., 'contactUs'].

      when i preview the flash, everything appears fine after the flash loads  and just up to the homepage movie clip, including the nested menu movie  clip and start animations, etc.  then, when i click on a menu item,  instead of playing the appropriate movie clip, flash plays EVERY SINGLE  MOVIE CLIP simultaneously on the stage; they all sort of display and  play at once.  what am i doing wrong?

      any help appreciated!


        • 1. Re: gotoAndPlay() problem [ newb ]
          Ned Murphy Adobe Community Professional & MVP

          If you can show a screenshot that includes your main timeline and maybe the code for that root function, it might help paint a clearer picture.  I'm not sure, but you might want to try using gotoAndStop instead of gotoAndPlay in that function.  Also, if you can show the code that your menu uses to make any apryicular section play out, that might be helpful as well.

          1 person found this helpful
          • 2. Re: gotoAndPlay() problem [ newb ]
            dropkick1 Level 1

            thanks for your reply! unfortunately the problem was due to a stupid error... :-/

            each layer on the timeline should've been cleared out after the subpage was displayed, which i forgot to do. i put in an extra keyframe after the one w/the subpage in it and cleared out all following frames, and it works now.

            thanks for your input!