Extending TitleWindow (SizeableTitleWindow/MaxRestorePanel, or the beauty of inheritance )

January 22, 2007 at 3:08 am | Posted in components, flash, flex2 | 4 Comments

Creating custom components with flex 2 is really easy, even if you are new to mxml and as3. (To develop custom components in flash 8 you need great knowledge of as2 and component’s architecture…)

In Flex 2 TitleWindow doesn’t support sizeable capabilities or custom buttons (only “x” button). Based in 2 examples (SizeableTitleWindow and MaxRestorePanel ) you can extend TitleWindow and achieve such functionalities.

1. Freely Available “SizeableTitleWindow” With Adobe’s ColdFusion/Flex Connectivity

To make it work you have to change a couple of lines:

Re: [flexcoders] Re: Resizable, Collapsible, Draggable Panel??

2. Now Extend your SizeableTitleWindow with MaxRestorePanel: (Code here: [flexcoders] Re: custom Panels original size ). Original MaxRestorePanel extends Panel, you can change it to extend SizeableTitleWindow… and voil√°… this is your first custom flex 2 component…

It is really a copy-paste custom component… but looking to the code you can learn some internals related to components architecture and how to build your own extensions… specially in SizeableTitleWindow’s code.

(Offtopic: my first flash RIA was made with Flash MX, those components are the “great-grandfathers” of flex 2 … this is an amazing evolution of flash as a platform to develop business applications.¬† Thank you Adobe/Macromedia ).


Blog at WordPress.com.
Entries and comments feeds.