Share on Google+Share on Google+

Action Script custom components

You can create custom components by define Action Script class.

Flex Custom Components using Action Script:-

You can create custom components by define Action Script class. User can create two type of custom components. First is visual custom components like Button, LinkButton, CheckBox, ComboBox etc. components  and second is nonvisual components like formatter, validators subclasses. In this tutorial we have create a custom ButtonBar component. The process is that you will create a subclass of the Action Script component class and methods for the these custom components. If user want to used properties for that components then declear variable name and create setter and getter method for that custom components.

Example:- class code

package custocumponent



import mx.controls.Alert;

import mx.controls.Button;

import mx.controls.ButtonBar;

public class buttonBar extends ButtonBar {

public function buttonBar() {


var mybutton1:Button = new Button();

mybutton1.label = "Submit";


var mybutton2:Button = new Button();

mybutton2.label = "Login";


var mybutton3:Button = new Button();

mybutton3.label = "Register";





mainapplication.mxml code:

<?xml version="1.0"?>

<mx:Application xmlns:mx=""




User download this code and run the output is:

Download this code


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.

Discuss: Action Script custom components  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image