Setting the height of the control bar in a Spark Application container in Flex 4

The following example shows how you can set an explicit height on the Spark Application container control bar by setting the height property on the controlBarGroup skin part.

By default the control bar sizes itself to its content, so I don’t really recommend setting an explicit height unless you really want to.

The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see To download the latest nightly build of the Flex 4 SDK, see

For more information on getting started with Flex 4 and Flash Builder 4, see the official Adobe Flex Team blog.

<?xml version="1.0" encoding="utf-8"?>
<!-- -->
<s:Application name="Spark_Application_controlBarGroup_height_test"
        <mx:Form backgroundAlpha="0.3" backgroundColor="red"
                creationComplete="sldr.value = controlBarGroup.height;">
            <mx:FormItem label="controlBarGroup.height:" direction="horizontal">
                <s:HSlider id="sldr"
                        minimum="30" maximum="150"
                        change="controlBarGroup.height = sldr.value;" />
                <s:Label id="txt"
                        enterFrame="txt_enterFrameHandler(event);" />
        <s:VerticalLayout paddingLeft="20" paddingTop="20" />
            protected function txt_enterFrameHandler(evt:Event):void {
                if (controlBarGroup) {
                    txt.text = controlBarGroup.height.toString();
    <s:CheckBox id="chckBx"
            change="controlBarVisible = chckBx.selected;" />


View source is enabled in the following example.

This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.