15 Replies Latest reply on May 25, 2009 3:17 PM by McFrisco

    Numeric Stepper Component--putting it on a Tween breaks it.  Why?

    McFrisco Level 1

      This script is straight out of the ActionScript 2.0 docs.  It works as advertised when it is on the root level stage.

      But if I put it on a tweened layer (so I can move it onto the screen with some other stuff), it no longer works.

      Anybody know why and how to make it work?

       

      /**
      Requires:
      - NumericStepper component on Stage (instance name: my_nstep)
      - Label component on Stage (instance name: my_label)
      */

      var my_nstep:mx.controls.NumericStepper;
      var my_label:mx.controls.Label;

      my_label.text = "value = " + my_nstep.value;

      //Create listener object.
      var nstepListener:Object = new Object();
      nstepListener.change = function(evt_obj:Object) {
      my_label.text = "value = " + evt_obj.target.value;
      };

      //Add listener.
      my_nstep.addEventListener("change", nstepListener);

       

      :<)Thanks!