Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 213

Creating and extending flex 2 components
Hide thumbs Also See for FLEX 2 - CREATING AND EXTENDING COMPONENTS:
Table of Contents

Advertisement

error="Invalid Format String";
return ""
}
// If the formatString and value are valid, format the number.
var dataFormatter:SwitchSymbolFormatter =
new SwitchSymbolFormatter();
return dataFormatter.formatValue( formatString, value );
}
}
}
The following example uses this custom formatter in an application:
<?xml version="1.0" encoding="UTF-8"?>
<!-- formatters/formatterSS.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myFormatters.*">
<!-- Declare a formatter and specify formatting properties. -->
<MyComp:CustomSSFormatter id="SSFormat"
formatString="SS: #-#-#-#-#-#-#-#-#"/>
<!-- Trigger the formatter while populating a string with data. -->
<mx:TextInput text="Your SS number is {SSFormat.format('123456789')}"/>
</mx:Application>
Using the SwitchSymbolFormatter class
213

Advertisement

Table of Contents
loading

Table of Contents