0 Replies Latest reply on Jan 26, 2007 1:36 AM by Camus Miu

    Refer a variable to other variable

    Camus Miu Level 1
      Hi all,

      I have a silly question...
      How do we make a variable reference in Actionscript 3??

      e.g. in MXML we can do following

      <mx:Script>
      [Bindable] private _abc:String;
      </mx:Script>

      <mx:Label text = {this._abc} />

      then the text of the label updated whenever we changed _abc.

      However if we do it in actionscript like:

      <mx:Script>
      [Bindable] private _abc:String;

      var labelObj:Label = new Label();
      labelObj.text = this._abc;
      addChild(labelObj);
      </mx:Script>

      Then the text of labelObj didn't update when _abc changed.
      I know we can make the _abc as setter/getter function to dispatch event and update the label text whenever event is dispatch.
      However, there should be something like refer labelObj.text to some variable, rite??

      Any Idea?

      Thanks~~