15 Replies Latest reply on Feb 1, 2010 4:56 AM by Sebastien V.

    Label does not reflect changes in the string

    uzairseedat

      I have a situation where I have a couple of ArrayCollections and a String inside my Model class (all are public static). I use AS Reflection API to show all the available variables in the Model to the user and choose one of them. Whatever the user selects is given to a custom component through a setter function.

       

      If user selects ArrayCollection, the custom component assigns it as dataProvider to one of the chart controls inside it. However, if the user selects the string variable, the component assigns its value to a Label text present inside it. Later, if I change values in ArrayCollection externally, the changes are reflected in the chart but if I change the value of the string variable (externally), the Label doesn't show up changes. How do I get through it?

       

      Following are the two sections from the custom component:

       

       

      /////////////////////////////////////////////////////////////////////////////////

      puiblic var provider:Object;

       

       

      public function set dataElement(newData:Object):void

      {

       

       

      var dataName:String = newData as String;

       

       

      var type:Type = Type.forClass(Model.ModelLocator);

       

       

      var field:Field = type.getField(dataName);

       

       

      this.provider = field.getValue();

      }

       

      ///////////////////////////////////////////////////////////////////////////////

       

       

       

       

      and later I do this (within the same custom component)

       

       

       

       

      ////////////////////////////////////////////////////////////////////////////////

       

      var lbl:Label = new Label();

      lbl.Data = this.provider as String;

       

      //////////////////////////////////////////////////////////////////////////////