A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Navigation buttons that set their own state

  1. #1

    Navigation buttons that set their own state

    I was hoping somebody would be able to help me. I am trying to develop a navigation system consisting of five buttons. When one is pressed I need to make sure the previously clicked button returns to its normal state while the newly clicked button now changes to it's "HIT" state. This would continue throughout with the newly "HIT" button resetting the previous button to it's normal state. Any ideas??

  2. #2
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    use a movie clip...not a button...and in the movie clips, have 2 frames, each with a stop(); command on them, frame 1 will be the normal state, and frame 2 will be the hit state...then put this code on frame 1 of the _root timeline:
    Code:
    var buttons=["button1","button2",etc...];//add the instance names for all of the buttons used here
    var hitButtonID=0;
    for (i=0;i<buttons.length;i++){
         _root[buttons[i]].ID=i;
         _root[buttons[i]].onRelease=function(){
              this.gotoAndStop(2);
              _root[buttons[_root.hitButtonID]].gotoAndStop(1);
              _root.hitButtonID=this.ID;
         };
    }
    Last edited by MyFriendIsATaco; 08-06-2005 at 12:27 AM.

  3. #3

    Thanks but still having trouble

    The code worked as far as changing the buttons from normal state to hit state, but when the second button is pressed the first button is staying on it's hit state instead of returning to it's normal state. I am using MX if that matters.

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