1 Reply Latest reply on Oct 3, 2007 8:26 AM by clbeech

    AS for Button States

    J_Tremain Level 1
      I have a menu that consists of 5 buttons. Each button has rollover functionality that changes the text from white to red when the mouse is rolled over them. What I want to happen is that when you click one of the menu options, I want the button to remain red, showing that it's the active section that the user is viewing. I've tried doing this both by using buttons and movie clips but I think my actionscript for reseting the color on roll out is messing me up. Any help?
        • 1. Re: AS for Button States
          clbeech Level 3
          OK, you can't 'hold' or 'set' a button instance to a 'state' so you need to use MC button instances. this way you can tell the MC to stay on the '_over' or down state by calling ...

          mc_btn.onPress = function() {
          this.gotoAndStop('_over');
          this.enabled = false;
          }

          ... when you move to a diferent 'page' you simply reset the MC to the '_up' state. so you may need to either track the page position with a variable OR reset all of the MC buttons each time.

          you could do this by first constructing your five buttons, with two states, one labeled '_up', and the other labeled '_over', by doing so Flash recongizes them as 'buttons' and will apply the onRollOver and onRollOut functionallity for you. next set up an array on the buttons, and assign the universal functions for all instances, as in the code below: