Home > flex > Custom Components

Custom Components

One of the main uses of MXML components is to extend the functionality of an existing Flex component.

Custom Components are one of the best features of flex.you can create custom components in flex  by creating a new component file

<?xml version="1.0" encoding="utf-8"?>
<mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:dataProvider>
        <mx:String>United States</mx:String>
        <mx:String>United Kingdom</mx:String>
        <!-- Add all other countries. -->

    </mx:dataProvider>
</mx:ComboBox>
a custom component may look like this.
you can notice that its not an application file and it is just a
combo box,because it can be written only as an component and can be called
in any part of the main
application.

<?xml version="1.0" encoding="utf-8"?>

<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:custom="components.*"
    width="220" height="115"
>

    <custom:CountryComboBox/>
</mx:Application>

the main purpose of using a custom components are its reusablity features.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: