1 Reply Latest reply on Aug 19, 2008 6:10 PM by Noelbaland

    flash nav bar help

    ecryptinc
      hello,
      novice here, doing some 'self-taught' learning. created a nav bar in flash and now need to learn how to add the links. any help,, guidance, or even referral to a helpful source is MUCH MUCH appreciated.
      here's my action script:

      import fl.transitions.Tween;
      import fl.transitions.easing.*;

      ourStory_mc.buttonMode = true;
      solutions_mc.buttonMode = true;
      newsroom_mc.buttonMode = true;
      investors_mc.buttonMode = true;
      toolsSupport_mc.buttonMode = true;
      contacts_mc.buttonMode = true;
      logIn_mc.buttonMode = true;

      ourStory_mc.addEventListener(MouseEvent.ROLL_OVER, hover);
      solutions_mc.addEventListener(MouseEvent.ROLL_OVER, hover);
      newsroom_mc.addEventListener(MouseEvent.ROLL_OVER, hover);
      investors_mc.addEventListener(MouseEvent.ROLL_OVER, hover);
      toolsSupport_mc.addEventListener(MouseEvent.ROLL_OVER, hover);
      contacts_mc.addEventListener(MouseEvent.ROLL_OVER, hover);
      logIn_mc.addEventListener(MouseEvent.ROLL_OVER, hover);

      function hover(e:MouseEvent):void
      {
      new Tween(bar_mc,"x",Strong.easeOut,bar_mc.x,e.currentTarget.x,1,true);
      }

      thank you so much for your ime!
      kasia
        • 1. flash nav bar help
          Noelbaland Level 1
          Hello there,

          So now you add an event listener for a mouse click on your buttons.

          ourStory_mc.addEventListener(MouseEvent.CLICK, onClick);
          solutions_mc.addEventListener(MouseEvent.CLICK, onClick);
          newsroom_mc.addEventListener(MouseEvent.ROLL_OVER, onClick);
          etc...

          Then you create the onClick function. I like using a switch/case statement to get the label of the button that is clicked and then sending the playhead to the right frame. The label is the instance name of the button. e.g. ourStory_mc

          function onClick(event:MouseEvent):void {
          switch (event.currentTarget.label)
          {
          case "ourStory_mc" :
          gotoAndStop(2);
          break;
          case "solutions_mc" :
          gotoAndStop(3);
          break;
          case "newsroom_mc" :
          gotoAndStop(4);
          break;

          etc...
          }
          }

          Hope that helps