4 Replies Latest reply on Mar 31, 2011 11:12 AM by kkiddle2010

    Question From a Square One Newbie

    kkiddle2010

      Okay so I just recently started playing around with flash. I'm creating an entirely flash website for my music. I have the layout and everything I want to do.

      Basically, I want to have the viewer click on a button (home, about me, music...ect...) and have the page above the "menu" bar change to the appropriate page. I know I know, use buttons and scenes.

      BUT the issue I'm having is that I have actionscript (not sure which one, again I'm pretty new,) already in the script, and I'm not sure how to change it so that both a button scene type thing would work.

      This is what (I'm assuming) the scene button action would look like. I know that this is actionscript 3:

       

      button_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene);

       

      function fl_ClickToGoToScene(event:MouseEvent):void
      {
           MovieClip(this.root).gotoAndPlay(1, "Scene 3");
      }

       

      Here's the code I have in it already for the sliding graphic thing:

       

      //Script Frame One:

      if (_root._xmouse > _level0.circle._x) {
      _level0.circle._x = (_level0.circle._x + 20);
      } else {
      _level0.circle._x = (_level0.circle._x - 20);
      }

       

      //Script Frame Two:


      if (_root._xmouse > _level0.circle._x) {
      _level0.circle._x = (_level0.circle._x + 20);
      } else {
      _level0.circle._x = (_level0.circle._x - 20);
      }
      gotoAndPlay (1);

       

       

       

       

       

      http://karimusic.weebly.com/  <<<----I just put the swf file on a random weebly site, just look at the flash like it will be the whole website.

      Thanks for any help!

        • 1. Re: Question From a Square One Newbie
          kglad Adobe Community Professional & MVP

          you'll probably need to fix that frame 1/frame 2 loop stuff unless that's on a timeline that's not related to your navigation.

           

          other than that, does button_1 do what you want?

          1 person found this helpful
          • 2. Re: Question From a Square One Newbie
            kkiddle2010 Level 1

            Okay I put the script on one frame instead of two (I'm guessing that's what you were suggesting? Sorry, still a little new to this.)

            It works the same, but it doesn't work in actionscript 3, which is what I need to use the button code.

             

            And I tried testing the button scene thing (sorry, don't know what it's called, bare with me.) What happened is

            1. I added a new scene to be one of the pages.

            2. Entered the code into the button and made "Scene 2" the target, so when I click on the button, Scene 2 will appear.

             

            What I got was a flashing swf from scene 1 to scene 2. Is this from the loop? Is there anyway to keep the cool blue sliding thing *and* be able to click on a button and change to a different scene?

             

            Thanks!

            • 3. Re: Question From a Square One Newbie
              kglad Adobe Community Professional & MVP

              1.  you need a stop() attached to a frame where you want your main timeline to stop.  otherwise, your swf will play through all your frames in all your scenes and then loop and repeat.

               

              2.  do you have a button named button_1 on stage and do you have a "Scene 3"?  if yes, the following should work:

               

               

              button_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene);

               

              function fl_ClickToGoToScene(event:MouseEvent):void
              {
                   MovieClip(this.root).gotoAndPlay(1, "Scene 3");  // again the timeline will not stop unless there's a stop() somewhere (or gotoAndStop() ).
              }

              • 4. Re: Question From a Square One Newbie
                kkiddle2010 Level 1

                Thank you so much! I added the stop and that code and it worked perfectly. Now I just need to translate my actionscript 1 to 3 and I'll be all set.

                Thanks again!