Setting a bitmap image fill on a Spark FormHeading control in Flex Hero

The following example shows how you can set a bitmap image fill on a Spark FormHeading control in Flex Hero by creating a custom FormHeading skin and creating a repeating BitmapFill object.

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

<?xml version="1.0" encoding="utf-8"?>
<!-- -->
<s:Application name="Spark_FormHeading_BitmapFill_test"
        <s:VerticalLayout horizontalAlign="center" verticalAlign="middle" />
        @namespace s "library://";
        s|FormHeading {
            backgroundAlpha: 0.4;
            skinClass: ClassReference("skins.CustomSparkFormHeadingSkin");
    <s:Form id="frm" defaultButton="{submitBtn}" backgroundColor="#EEEEEE">
        <s:FormHeading id="fh1"
                label="Spark Form Heading" />
        <s:FormItem sequenceLabel="1." label="Username:" required="true">
                <s:Label text="" />
            <s:TextInput id="username" />
        <s:FormItem sequenceLabel="2." label="Password:" required="true">
                <s:Label text="weak" color="red" />
            <s:TextInput id="password1" displayAsPassword="true" />
        <s:FormItem sequenceLabel="3." label="Confirm password:">
                    <s:Label text="One" color="red" />
                    <s:Label text="Two" color="blue" />
            <s:TextInput id="password2" displayAsPassword="true" />
                <s:HorizontalLayout />
            <s:Button id="resetBtn" label="Reset" />
            <s:Button id="submitBtn" label="Submit" />

And the custom Spark FormHeading skin class, skins/CustomSparkFormHeadingSkin.mxml, is as follows:

<?xml version="1.0" encoding="utf-8"?>
<!-- -->
<s:Skin name="CustomSparkFormHeading"
        <s:State name="normal" />
        <s:State name="disabled" />
                <s:ConstraintColumn id="sequenceCol" />
                <s:ConstraintColumn id="labelCol" />
                <s:ConstraintColumn id="contentCol"/>
                <s:ConstraintColumn id="helpCol"/>
                <s:ConstraintRow id="row1" />
    <fx:Script fb:purpose="styling">
            override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
                bgFill.alpha = getStyle("backgroundAlpha");
                super.updateDisplayList(unscaledWidth, unscaledHeight);
    <!--- Defines the appearance of the Form class's background. -->
    <s:Rect id="background" left="0" right="0" top="0" bottom="0">
            <s:BitmapFill id="bgFill" source="@Embed('assets/pattern_149.gif')" fillMode="repeat" />
    <s:Label id="labelDisplay"
            left="labelCol:0" right="helpCol:10" top="row1:10" bottom="row1:10" />

This entry is based on a beta version of the Flex Hero 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 Hero SDK.