Share on Google+Share on Google+

Flex custom components

In the Flex 3 development, User can create custom components using mxml or ActionScript

Custom Flex Components:

In the Flex 3 development, User can create custom components using mxml or ActionScript. In this example user can see mxml custom component. The purpose to create custom components in the Flex application is easy to develop, reusability, maintainability. User create these components if application require these custom components. Custom components functionality of the Flex provide us for break up your code with in Flex application into sub parts of the application. We can create custom components in both  mxml and Action Script. In this example we have create a button bar custom component. First we will create a custom component and after using namespace we will used it. The main purpose is to create custom components for your specific application requirements.


buttonbar.mxml code:

<?xml version="1.0"?>

<mx:ButtonBar xmlns:mx="" borderStyle="solid" horizontalGap="5">







We have create a ButtonBar component and create a data provider for it after that we have create application using this component.

mainapplication.mxml code:

<?xml version="1.0"?>

<mx:Application xmlns:mx="" xmlns:CustComp="custocumponent.*">



In the mainapplication.mxml, we have used buttonbar custom component with namespace prefix CustComp. The namespace prefix told you to look for the file that implements custom components and tag name corresponds to the file name of the components. In this example we have create a package that hold buttonbar.mxml custom component and mainapplication.mxml  that define Flex application.


Download this code

Action Script custom components
You can create custom components by define Action Script class.
Package in Action Script 3
Package is the collection of related classes. Package describe the directory structure of your component of your application


Posted on: July 13, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null