0 Replies Latest reply on Sep 21, 2006 9:57 AM by buzzbait_01

    Many Buttons : One handler?

    buzzbait_01
      I have created a mapping application which displays country maps organized by continent. Each country is a button within a movie clip which contains all of the country buttons for a Continent. So the button for Brazil is btnBRAZIL and is within the MC_SouthAmerica movie clip.

      I have created handlers for each button instance (see below). Each handler does the same thing - sets variables based on the button itself and calls a handler. This works but will get crazy when I have 230 buttons.

      Is there a way to create a listener or other construct, that I can attach to the continent clip, that will listen for a button click, then pass on the information about which button was clicked?

      Any advice would save my what's left of my hair.


      -----------------------------------

      btnBRAZIL.onRelease = function () {
      _global.scale_x = this._xscale
      _global.scale_y = this._yscale
      _global.theX = this._x;
      _global.theY = this._y;
      _global.buttonX = this._width;
      _global.buttonY =this._height;
      _global.theCountry = this._name;
      _parent.getData();
      }

      btnBOLIVIA.onRelease = function () {
      _global.scale_x = this._xscale
      _global.scale_y = this._yscale
      _global.theX = this._x;
      _global.theY = this._y;
      _global.buttonX = this._width;
      _global.buttonY =this._height;
      _global.theCountry = this._name;
      _parent.getData();
      }