Creating a custom component in Flex

In this post I intend to provide pointers to appropriate methods in order to customize a specific UIComponent implementation.
As all controls extend the UIComponent class,  hence some of the common methods you might want to override are

createChildren(): Add the child controls in the custom control here. More Info

commitProperties(): Update/Bind the properties of the child controls in the custom control here. This is the last method to be called before rendering, hence it is a good place to update the properties of the child controls to acheive the binding . More Info

measure(): Handle the computation of the min/max values of the width, height and other dimensions of the custom component here. More Info

updateDisplayList(): Specify the location(co-ordinates) of the child controls and handle the programmatic drawing here. More Info

We would not require to make an explict call to any of the methods above as they are called by the Flex framework itself, we only need to plugin in the custom code in the invocation sequence appropriately. Refer to the link “More Info” for a comprehensive documentation of the usage of the methods.

We may not need to override all of them, but it is important to know the appropriate method to be overriden. Also do not forget to call the implementation of the base class unless you are really sure to do so.

Advertisements

1 comment so far

  1. […] choice but then you need to know how and where to insert the custom implementation. Refer to my post on creating custom Flex controls for more info on it. Also you need to be able to differnetiate […]


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: