Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 215

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

Advertisement

// If the formatString is anything other than '#####*####,
// call super and validate and format as usual using
// the base ZipCodeFormatter.
return super.format(value);
}
}
}
Notice that the ExtendedZipCodeFormatter class did not have to define a
property because it is already defined in its base class, ZipCodeFormatter.
The following example uses this custom formatter in an application:
<?xml version="1.0" encoding="UTF-8"?>
<!-- formatters/FormatterZC.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myFormatters.*">
<!-- Declare a formatter and specify formatting properties. -->
<MyComp:ExtendedZipCodeFormatter id="ZipCodeFormat"/>
<!-- Trigger the formatter while populating a string with data. -->
<mx:TextInput width="200"
text="Your zipcode number is {ZipCodeFormat.format('123456789')}"/>
</mx:Application>
formatString
Extending a Formatter class
215

Advertisement

Table of Contents
loading

Table of Contents