1 Reply Latest reply on Apr 23, 2006 9:56 AM by rapheld

    Lisetening for Property change

      I have created a MC to be used as a button. It is generic and I customize it per instance. It contains an onRelease event handler.

      I am confused as to what approach I can take within the MC's onRelease statement that would allow the parent to 1> know the MC has been clicked & 2> know which instance of the MC has been clicked (without putting onRelase code for each instance at the parent level).

      I was trying the following...

      myMC.onRelease = function() {
      _parent.clickedButton = myMC._name;

      ...but I couldn't figure how to make the parent listen for a change to clickedButton.

      How can I listent for a variable change? Is there a better approach?

        • 1. Lisetening for Property change
          rapheld Level 1
          Looks like I can answer my own question. In case anyone else is confused as to how to do this, I used the Object.watch method.

          After doing the above in the MC, I included the following in the parent...
          var btnWatcher:Function = function(prop, oldVal, newVal, userData) {

          this.watch("clickedButton", btnWatcher);