Formats an eight-digit number to be split by a dash
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.formatters.SwitchSymbolFormatter;
public var fmtSymbol:SwitchSymbolFormatter = new SwitchSymbolFormatter("#");
public function formatMe(rawData:String):String
{
return fmtSymbol.formatValue("####-####",rawData);
}
</mx:Script>
<mx:XML id="myData">
<root>
<item name="Fix something" id="1234567890" />
</root>
</mx:XML>
<mx:Label text="Work Order: {formatMe(myData.item.@id)}" />
</mx:Application>
Related examples in the same category