Setting the background image resize mode on a Spark Border container in Flex 4

The following example shows how you can set the background image resize mode on a Spark Border container in Flex 4 by setting the backgroundImageResizeMode style.

Full code after the jump.

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_Border_backgroundImageResizeMode_test"
        <mx:Form paddingTop="0" paddingBottom="0">
            <mx:FormItem label="backgroundImageResizeMode:">
                <s:DropDownList id="dropDownList" requireSelection="true">
                        <s:ArrayList source="[scale,noScale,repeat]" />
            <mx:FormItem label="cornerRadius:">
                <s:HSlider id="slider" minimum="0" maximum="50" />
    <s:Border id="brdr"
            left="40" right="40" top="40" bottom="40">
        <s:Label id="sdkVer"
                initialize="sdkVer.text = mx_internal::VERSION;"
                horizontalCenter="0" verticalCenter="0" />

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.

12 thoughts on “Setting the background image resize mode on a Spark Border container in Flex 4

  1. I got this error?
    Could not resolve to a component implementation. Test.mxml Test/src line 29 Flex Problem

    Can anybody help? Tia

  2. I am working in …so I am stumped as to what is not correct then. I am new at Subersion and Ant. Do either of these need to be configured a certian way?

  3. Hi Peter,

    I am so glad you are still with me and patient to reply.

    I have in my SVN Repository.
    I have the warning “cannot load spark.swc
    And when I try running it in my browser I get a series of errors beginning with:
    VerifyError: Error #1014: Class IVisualElement could not be found.

    1. @Jeannie,

      I don’t use SVN, I always just grab the ZIP files from I’d suggest using one of those builds (10008 or newer). This way we can try and eliminate an SVN/Ant/build problem.

      I wouldn’t worry about those runtime errors (yet) as it seems like the “cannot load spark.swc” is a more serious issue. And hopefully one that won’t happen if you use a precompiled nightly build rather than trying to get the SVN build working.


  4. FLEX 4 is awesome………..

    Thanks peter…..your blog has been very helpful all these years……..


Comments are closed.