Construct SwitchSymbolFormatter
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="format()" >
<mx:Script>
import mx.formatters.SwitchSymbolFormatter;
private function format():void {
var switchSymbolFormatter:SwitchSymbolFormatter = new SwitchSymbolFormatter("*");
formatted.text = switchSymbolFormatter.formatValue(formatString.selectedItem..toString(), "0123456789");
}
</mx:Script>
<mx:Panel title="SwitchSymbolFormatter Example" width="400"
height="200">
<mx:Form>
<mx:FormItem label="Format String:">
<mx:ComboBox id="formatString" change="format()">
<mx:ArrayCollection>
<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>
Related examples in the same category