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.