Thursday, February 23, 2012

Flex TitleContentPanel Component

If you’re anything like me, you end up re-skinning the Panel (and/or TitleWindow) component nearly every project just so you can shove some controls into the title bar. I finally wizened up and decided to just create custom Panel that allows this.

The TitleContentPanel adds two additional content properties to the Panel, titleContent and actionContent. Each take an array of IVisualElements with the titleContent positioning its children on the left side of the title bar and actionConent to the right. There also exists titleContentLayout and actionContentLayout properties to override the layouts.

If titleContent is specified, the Panel’s title string is ignored. If you’re familiar with the ViewNavigator in the mobile SDK, it works very similar (and modeled after it, actually).

In the example below, the first Panel specifies a DropDownList in the actionContent. The next one adds an image and a button to the titleContent.

Either scripts and active content are not permitted to run or Adobe Flash Player version 11.1.0 or greater is not installed.

Get Adobe Flash Player

Source code located at:

No comments:

Post a Comment