1 Reply Latest reply on Feb 6, 2007 1:13 PM by jakelove007

    make function take input

    jakelove007
      the function below formats a datagrid column (mtm). How do I make this general such that I may pass in any column, not just the column mtm?
      thank you in advance.


      package {
      import mx.controls.Text;
      import mx.formatters.CurrencyFormatter


      public class MtmItemRenderer extends Text
      {
      override public function set data(value:Object):void {
      super.data = value;
      var cf:CurrencyFormatter = new CurrencyFormatter;
      cf.currencySymbol = "$";cf.precision = 2;
      if(value!=null) {
      if (Number(value.mtm) < 0)
      {
      this.setStyle("color","red");
      } else {
      this.setStyle("color","black");
      }

      this.text = cf.format(value.mtm);
      }
      super.invalidateDisplayList();
      }
      }
      }