ManualTable of ContentsAbout Flex Documentation7Contents7Using this manual7Accessing the Flex documentation8Documentation set8Viewing online documentation8Typographical conventions9Creating Custom Flex Components11Creating Flex Components13Contents13About creating components13The Flex class hierarchy15Customizing existing Flex components16The relationship between MXML components and ActionScript components16Deciding to create components in MXML or ActionScript17Creating new components18Creating custom components19Creating MXML components19Creating ActionScript components21Deploying components23Where to go from here23Using ActionScript to Create Components25Contents25Using ActionScript25Using the package statement25Using the import statement27Using the class statement28Defining the constructor28Defining properties as variables30Defining properties as getters and setters30Defining methods32Using the super keyword in a method override33About scope34Creating Custom Events35Contents35About events35Using an event object37Dispatching custom events38Creating a subclass from the Event class38Using the Event metadata tag40Dispatching an event41Creating static constants for the Event.type property42Using Metadata Tags in Custom Components45Contents45About metadata tags46Using metadata tags47Metadata tags49ArrayElementType metadata tag50Bindable metadata tag51Using read-only properties as the source for data binding54Using static properties as the source for data binding54DefaultProperty metadata tag55Effect metadata tag55Event metadata tag56IconFile metadata tag57Inspectable metadata tag58InstanceType metadata tag60NonCommittingChangeEvent metadata tag60Style metadata tag61Compiling Components63Contents63About compiling63Flex component file types64About compiling with Flex 2 SDK64About compiling with Flex Data Services65About case sensitivity during a compilation65About the ActionScript classpath65Compiling components with Flex 2 SDK66Distributing components as MXML and ActionScript files66Distributing components as SWC files67Distributing components as RSLs68Example: Compiling a custom formatter component68Distributing a component as an ActionScript file69Distributing a component as a SWC file71Distributing a component as an RSL file72Compiling components with Flex Data Services72Distributing components as MXML and ActionScript files73Distributing components as SWC files73Distributing components as RSLs73Creating MXML Components75Creating Simple MXML Components77Contents77About MXML components77Creating MXML components78MXML components and ActionScript classes80Creating composite MXML components81Scoping in custom components83Applying styles to your custom component84Applying styles from the custom component85Applying styles from the referencing file86Applying a type selector to the root tag of a custom component89Creating Advanced MXML Components91Contents91About reusable MXML components91Adding custom properties and methods to a component92Defining properties and methods in MXML components92Defining properties and methods in ActionScript93Defining properties in MXML95Defining properties by using setters and getters96Defining inspectable properties98Supporting data binding in custom properties99Passing references to properties of MXML components101Accessing the Application object101Passing a reference to the component105Passing a reference to the calling component106Working with events107Handling events from simple MXML components107Creating custom events109Handling events from composite components112About interfaces114About implementing IMXMLObject116Creating ActionScript Components119Creating Simple Visual Components in ActionScript121Contents121About ActionScript components121Example: Creating a simple component123Adding properties and methods to a component125Defining public properties in ActionScript125Accessing public properties in MXML125Defining public properties as variables127Defining public properties by using getter and setter methods128Creating a default property130Making properties accessible in Flex Builder132Using data binding with custom properties132Using properties as the destination of a binding expression132Using properties as the source of a data binding expression133Defining a method override137Initializing inherited properties with tag attributes in MXML139Defining events in ActionScript components140Handling predefined events within the component141Dispatching custom events142Applying styles to custom components144Creating Advanced Visual Components in ActionScript147Contents147About creating advanced components147About overriding protected UIComponent methods148About the invalidation methods149About the component instantiation life cycle150About the steps for creating a component153About interfaces154Implementing the component155Basic component structure156Implementing the constructor157Implementing the createChildren() method157Implementing the commitProperties() method158Implementing the measure() method162Calculating default sizes164Implementing the layoutChrome() method166Implementing the updateDisplayList() method166Overriding the layout mechanism of the VBox container168Drawing graphics in your component170Making components accessible170Adding version numbers171Best practices when designing a component172Example: Creating a composite component172Example: Composite component173Defining event listeners for composite components173Creating the ModalText component174Troubleshooting180Creating Custom Style Properties183Contents183About styles183About inheritance in Cascading Style Sheets184About setting styles184Setting styles using MXML tag attributes185Setting styles using the setStyle() method185Setting styles using CSS185About overriding the styleChanged() method186Example: Creating style properties187Defining a style property189Setting default style values192Defining a style property for a skin193Creating Template Components195Contents195About template components195Implementing a template component197Using general data types in a template component197Using IDeferredInstance in a template component199Defining properties using the IDeferredInstance interface201Defining a generic property201Restricting the data type of a property201Defining an array of template properties202Creating Nonvisual Flex Components205Creating Custom Formatters207Contents207Creating a custom formatter208Creating a simple formatter209Handling errors in formatters210Using the SwitchSymbolFormatter class211Using a different placeholder character211Handling errors with the SwitchSymbolFormatter class212Extending a Formatter class214Creating Custom Validators217Contents217Validating data by using custom validators217About overriding the doValidation() method218About the ValidationResult class218About the validate() method219Example: Creating a simple validator219Example: Validating multiple fields222Creating Effects227Contents227About creating a custom effect228Defining factory and instance classes228About the effect base classes229About implementing your effects classes229Example: Defining a simple effect232Example: Passing parameters to effects235About tween effects237Example: Creating a tween effect238Writing an effect for a transition240Defining the default values for a transition effect240Using the propertyChanges property242How Flex initializes the propertyChanges property242Example: Creating a transition effect243Defining a custom effect trigger247Overriding the initEffect() method250Index251Size: 1.27 MBPages: 254Language: EnglishOpen manual