1 Reply Latest reply on Mar 17, 2008 7:00 PM by ntsiii

    Formatter problem.....

    Gene Godsey Level 1
      I cannot egte this code to work and it appears to be OK but I get error 1061 of line 11 and error ands undefined method on 13.
      -------------------------
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
      creationComplete="format()" backgroundColor="#FFFFFF">

      <mx:Script>
      <![CDATA[
      import mx.formatters.SwitchSymbolFormatter;

      private function format():void {
      // Create Instance of the SwitchSymbolFormatter and pass in mask character
      var switchSymbolFormatter:SwitchSymbolFormatter = new SwitchSymbolFormatter("*");
      // Apply formatter on the unformatted TextInput data using selectedItem from ComboBox
      formatted.text = switchSymbolFormatter.formatValue(formatString.selectedItem..toString(), unformatted.text);
      }
      ]]>
      </mx:Script>

      <mx:Panel title="SwitchSymbolFormatter Example" width="400" height="200"
      paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">

      <mx:Form>
      <mx:FormItem label="Unformatted Data:">
      <mx:TextInput id="unformatted" text="123456789" editable="false"/>
      </mx:FormItem>
      <mx:FormItem label="Format String:">
      <mx:ComboBox id="formatString" change="format()">
      <mx:ArrayCollection>
      <mx:String># *-********</mx:String>
      <mx:String># ***-******</mx:String>
      <mx:String># **-***-****</mx:String>
      <mx:String># *******-**</mx:String>
      </mx:ArrayCollection>
      </mx:ComboBox>
      </mx:FormItem>
      <mx:FormItem label="Formatted Data:">
      <mx:TextInput id="formatted" editable="false"/>
      </mx:FormItem>
      </mx:Form>
      </mx:Panel>
      </mx:Application>
      -------------------------

      Any Ideas???
      Thanks,

      GG