0 Replies Latest reply on Dec 12, 2006 7:58 PM by nudnic

    Button group

    nudnic
      I have been working creating a group of buttons. Similar to a radio button
      group where only one button can be selected at a time. Here is a snippet
      of code:

      b_0.onRelease = function() {
      reset_buttons();
      this.enabled = false;
      this.gotoAndStop( "disabled" );
      // other button code
      }

      // Other buttons look like the one above

      reset_buttons = function() {
      for ( var i = 0; i < numofbuttons; i++ ) {
      var the_button = this[ "b_" + i ];
      the_button.enabled = true;
      the_button.gotoAndStop( "_up" );
      }
      }


      The code here works just fine but, I have been thinking there may be a
      better solution. I was reading about listener objects and began getting
      vague ideas that clicking one button could notify all of the other
      buttons.

      I have also been trying to upgrade by understanding of AS 2.0. I started
      to think this might be done as a class. Maybe something that extends
      movieClip?

      I'm looking for ideas or suggestions anyone might have to offer.

      thanks