<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; backgroundImageFillMode</title>
	<atom:link href="http://blog.flexexamples.com/tag/backgroundimagefillmode/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting a dynamically loaded background image fill on a Spark Border container in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/11/16/setting-a-dynamically-loaded-background-image-fill-on-a-spark-border-container-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2009/11/16/setting-a-dynamically-loaded-background-image-fill-on-a-spark-border-container-in-flex-4/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 03:18:06 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta2]]></category>
		<category><![CDATA[Border (Spark)]]></category>
		<category><![CDATA[SWFLoader]]></category>
		<category><![CDATA[backgroundImage]]></category>
		<category><![CDATA[backgroundImageFillMode]]></category>
		<category><![CDATA[Gumbo]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=2209</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2009/11/16/setting-a-background-image-fill-on-a-spark-border-container-in-flex-4/">&#8220;Setting a background image fill on a Spark Border container in Flex 4&#8243;</a>, we saw how you could set a background image fill on a Spark Border container in Flex 4 by setting the backgroundImage style to an embedded image.</p> <p>The following example shows how you can use a dynamically [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2009/11/16/setting-a-background-image-fill-on-a-spark-border-container-in-flex-4/">&#8220;Setting a background image fill on a Spark Border container in Flex 4&#8243;</a>, we saw how you could set a background image fill on a Spark Border container in Flex 4 by setting the <code>backgroundImage</code> style to an embedded image.</p>
<p>The following example shows how you can use a dynamically loaded image as a Spark Border container background by using an MX SWFLoader control and setting the backgroundImage style to the SWFLoader control&#8217;s <code>content</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-2209"></span></p>
<p class="note">And a big thanks to Jason Szeto for the clever SWFLoader trick!</p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/11/16/setting-a-dynamically-loaded-background-image-fill-on-a-spark-border-container-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Border_backgroundImage_dynamic_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> label=<span style="color: #ff0000;">&quot;ColdFusion&quot;</span> click=<span style="color: #ff0000;">&quot;swfLdr.load('cf_appicon-tn.gif');&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> label=<span style="color: #ff0000;">&quot;Flash Player&quot;</span> click=<span style="color: #ff0000;">&quot;swfLdr.load('fl_player_appicon-tn.gif');&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> label=<span style="color: #ff0000;">&quot;Flex&quot;</span> click=<span style="color: #ff0000;">&quot;swfLdr.load('fx_appicon-tn.gif');&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> label=<span style="color: #ff0000;">&quot;Adobe&quot;</span> click=<span style="color: #ff0000;">&quot;swfLdr.load('http://helpexamples.com/flash/images/logo.png');&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            protected function swfLdr_completeHandler<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                brdr.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;backgroundImage&quot;</span>, swfLdr.content<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:SWFLoader</span> id=<span style="color: #ff0000;">&quot;swfLdr&quot;</span> complete=<span style="color: #ff0000;">&quot;swfLdr_completeHandler(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Border</span> id=<span style="color: #ff0000;">&quot;brdr&quot;</span></span>
<span style="color: #000000;">            backgroundImageFillMode=<span style="color: #ff0000;">&quot;repeat&quot;</span></span>
<span style="color: #000000;">            borderColor=<span style="color: #ff0000;">&quot;haloOrange&quot;</span></span>
<span style="color: #000000;">            borderWeight=<span style="color: #ff0000;">&quot;10&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;320&quot;</span> height=<span style="color: #ff0000;">&quot;240&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;sdkVer&quot;</span></span>
<span style="color: #000000;">                color=<span style="color: #ff0000;">&quot;haloOrange&quot;</span></span>
<span style="color: #000000;">                fontSize=<span style="color: #ff0000;">&quot;48&quot;</span></span>
<span style="color: #000000;">                fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span></span>
<span style="color: #000000;">                left=<span style="color: #ff0000;">&quot;20&quot;</span> top=<span style="color: #ff0000;">&quot;20&quot;</span></span>
<span style="color: #000000;">                creationComplete=<span style="color: #ff0000;">&quot;sdkVer.text = mx_internal::VERSION;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Border</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="alert">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.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting a dynamically loaded background image fill on a Spark Border container in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/11/16/setting-a-dynamically-loaded-background-image-fill-on-a-spark-border-container-in-flex-4/',contentID: 'post-2209',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'backgroundImage,backgroundImageFillMode,Gumbo',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/11/16/setting-a-dynamically-loaded-background-image-fill-on-a-spark-border-container-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Setting a background image fill on a Spark Border container in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/11/16/setting-a-background-image-fill-on-a-spark-border-container-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2009/11/16/setting-a-background-image-fill-on-a-spark-border-container-in-flex-4/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 02:47:35 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta2]]></category>
		<category><![CDATA[Border (Spark)]]></category>
		<category><![CDATA[backgroundFill]]></category>
		<category><![CDATA[backgroundImage]]></category>
		<category><![CDATA[backgroundImageFillMode]]></category>
		<category><![CDATA[Gumbo]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=2203</guid>
		<description><![CDATA[<p>The following example shows how you can set a background image fill on a Spark Border container in Flex 4 by setting the backgroundImage style.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2009/11/16/setting-a-background-image-fill-on-a-spark-border-container-in-flex-4/ --&#62; &#60;s:Application name=&#34;Spark_Border_backgroundImage_test&#34; xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/halo&#34;&#62; &#160; &#60;s:Border id=&#34;brdr&#34; backgroundImage=&#34;@Embed('fx_appicon-tn.gif')&#34; backgroundImageFillMode=&#34;repeat&#34; borderColor=&#34;haloOrange&#34; borderWeight=&#34;10&#34; width=&#34;320&#34; height=&#34;240&#34; horizontalCenter=&#34;0&#34; verticalCenter=&#34;0&#34;&#62; &#60;s:Label id=&#34;sdkVer&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set a background image fill on a Spark Border container in Flex 4 by setting the <code>backgroundImage</code> style.</p>
<p>Full code after the jump.</p>
<p><span id="more-2203"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/11/16/setting-a-background-image-fill-on-a-spark-border-container-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Border_backgroundImage_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Border</span> id=<span style="color: #ff0000;">&quot;brdr&quot;</span></span>
<span style="color: #000000;">            backgroundImage=<span style="color: #ff0000;">&quot;@Embed('fx_appicon-tn.gif')&quot;</span></span>
<span style="color: #000000;">            backgroundImageFillMode=<span style="color: #ff0000;">&quot;repeat&quot;</span></span>
<span style="color: #000000;">            borderColor=<span style="color: #ff0000;">&quot;haloOrange&quot;</span></span>
<span style="color: #000000;">            borderWeight=<span style="color: #ff0000;">&quot;10&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;320&quot;</span> height=<span style="color: #ff0000;">&quot;240&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;sdkVer&quot;</span></span>
<span style="color: #000000;">                color=<span style="color: #ff0000;">&quot;haloOrange&quot;</span></span>
<span style="color: #000000;">                fontSize=<span style="color: #ff0000;">&quot;48&quot;</span></span>
<span style="color: #000000;">                fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span></span>
<span style="color: #000000;">                left=<span style="color: #ff0000;">&quot;20&quot;</span> top=<span style="color: #ff0000;">&quot;20&quot;</span></span>
<span style="color: #000000;">                creationComplete=<span style="color: #ff0000;">&quot;sdkVer.text = mx_internal::VERSION;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Border</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>You can also set the <code>backgroundImage</code> and <code>backgroundImageFillMode</code> styles in an external .CSS file or &lt;Style/&gt; block, as seen in the following example:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/11/16/setting-a-background-image-fill-on-a-spark-border-container-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Border_backgroundImage_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        @namespace s &quot;library://ns.adobe.com/flex/spark&quot;;
        @namespace mx &quot;library://ns.adobe.com/flex/halo&quot;;
&nbsp;
        s|Border {
            backgroundImage: Embed(&quot;fx_appicon-tn.gif&quot;);
            backgroundImageFillMode: repeat;
            borderColor: haloOrange;
            borderWeight: 10;
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Border</span> id=<span style="color: #ff0000;">&quot;brdr&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;320&quot;</span> height=<span style="color: #ff0000;">&quot;240&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;sdkVer&quot;</span></span>
<span style="color: #000000;">                color=<span style="color: #ff0000;">&quot;haloOrange&quot;</span></span>
<span style="color: #000000;">                fontSize=<span style="color: #ff0000;">&quot;48&quot;</span></span>
<span style="color: #000000;">                fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span></span>
<span style="color: #000000;">                left=<span style="color: #ff0000;">&quot;20&quot;</span> top=<span style="color: #ff0000;">&quot;20&quot;</span></span>
<span style="color: #000000;">                creationComplete=<span style="color: #ff0000;">&quot;sdkVer.text = mx_internal::VERSION;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Border</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Or you can set the <code>backgroundImage</code> and <code>backgroundImageFillMode</code> styles using ActionScript, as seen in the following example:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/11/16/setting-a-background-image-fill-on-a-spark-border-container-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Border_backgroundImage_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Graphic</span> click=<span style="color: #ff0000;">&quot;brdr.setStyle('backgroundImage', cfFill);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:BitmapImage</span> source=<span style="color: #ff0000;">&quot;{cfFill}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Graphic</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Graphic</span> click=<span style="color: #ff0000;">&quot;brdr.setStyle('backgroundImage', flPlayerFill);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:BitmapImage</span> source=<span style="color: #ff0000;">&quot;{flPlayerFill}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Graphic</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Graphic</span> click=<span style="color: #ff0000;">&quot;brdr.setStyle('backgroundImage', fxFill);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:BitmapImage</span> source=<span style="color: #ff0000;">&quot;{fxFill}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Graphic</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;cf_appicon-tn.gif&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></span>
<span style="color: #000000;">            protected const cfFill:Class;</span>
&nbsp;
<span style="color: #000000;">            <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;fl_player_appicon-tn.gif&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></span>
<span style="color: #000000;">            protected const flPlayerFill:Class;</span>
&nbsp;
<span style="color: #000000;">            <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;fx_appicon-tn.gif&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></span>
<span style="color: #000000;">            protected const fxFill:Class;</span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Border</span> id=<span style="color: #ff0000;">&quot;brdr&quot;</span></span>
<span style="color: #000000;">            backgroundImage=<span style="color: #ff0000;">&quot;{fxFill}&quot;</span></span>
<span style="color: #000000;">            backgroundImageFillMode=<span style="color: #ff0000;">&quot;repeat&quot;</span></span>
<span style="color: #000000;">            borderWeight=<span style="color: #ff0000;">&quot;10&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;320&quot;</span> height=<span style="color: #ff0000;">&quot;240&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;sdkVer&quot;</span></span>
<span style="color: #000000;">                color=<span style="color: #ff0000;">&quot;haloOrange&quot;</span></span>
<span style="color: #000000;">                fontSize=<span style="color: #ff0000;">&quot;48&quot;</span></span>
<span style="color: #000000;">                fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span></span>
<span style="color: #000000;">                left=<span style="color: #ff0000;">&quot;20&quot;</span> top=<span style="color: #ff0000;">&quot;20&quot;</span></span>
<span style="color: #000000;">                creationComplete=<span style="color: #ff0000;">&quot;sdkVer.text = mx_internal::VERSION;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Border</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>You can also set the background image by setting the <code>backgroundFill</code> property to a BitmapFill object, as seen in the following example:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/11/16/setting-a-background-image-fill-on-a-spark-border-container-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Border_backgroundImage_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Border</span> id=<span style="color: #ff0000;">&quot;brdr&quot;</span></span>
<span style="color: #000000;">            borderColor=<span style="color: #ff0000;">&quot;haloOrange&quot;</span></span>
<span style="color: #000000;">            borderWeight=<span style="color: #ff0000;">&quot;10&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;320&quot;</span> height=<span style="color: #ff0000;">&quot;240&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:backgroundFill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:BitmapFill</span> source=<span style="color: #ff0000;">&quot;@Embed('fx_appicon-tn.gif')&quot;</span> fillMode=<span style="color: #ff0000;">&quot;repeat&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:backgroundFill</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;sdkVer&quot;</span></span>
<span style="color: #000000;">                color=<span style="color: #ff0000;">&quot;haloOrange&quot;</span></span>
<span style="color: #000000;">                fontSize=<span style="color: #ff0000;">&quot;48&quot;</span></span>
<span style="color: #000000;">                fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span></span>
<span style="color: #000000;">                left=<span style="color: #ff0000;">&quot;20&quot;</span> top=<span style="color: #ff0000;">&quot;20&quot;</span></span>
<span style="color: #000000;">                creationComplete=<span style="color: #ff0000;">&quot;sdkVer.text = mx_internal::VERSION;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Border</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Or you could embed the image using ActionScript and use data binding to define the BitmapFill object&#8217;s <code>source</code> property, as seen in the following example:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/11/16/setting-a-background-image-fill-on-a-spark-border-container-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Border_backgroundImage_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;fx_appicon-tn.gif&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></span>
<span style="color: #000000;">            private const fxFill:Class;</span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Border</span> id=<span style="color: #ff0000;">&quot;brdr&quot;</span></span>
<span style="color: #000000;">            borderColor=<span style="color: #ff0000;">&quot;haloOrange&quot;</span></span>
<span style="color: #000000;">            borderWeight=<span style="color: #ff0000;">&quot;10&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;320&quot;</span> height=<span style="color: #ff0000;">&quot;240&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:backgroundFill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:BitmapFill</span> source=<span style="color: #ff0000;">&quot;{fxFill}&quot;</span> fillMode=<span style="color: #ff0000;">&quot;repeat&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:backgroundFill</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;sdkVer&quot;</span></span>
<span style="color: #000000;">                color=<span style="color: #ff0000;">&quot;haloOrange&quot;</span></span>
<span style="color: #000000;">                fontSize=<span style="color: #ff0000;">&quot;48&quot;</span></span>
<span style="color: #000000;">                fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span></span>
<span style="color: #000000;">                left=<span style="color: #ff0000;">&quot;20&quot;</span> top=<span style="color: #ff0000;">&quot;20&quot;</span></span>
<span style="color: #000000;">                creationComplete=<span style="color: #ff0000;">&quot;sdkVer.text = mx_internal::VERSION;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Border</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Or you could declare the BitmapFill object in an &lt;fx:Declarations/&gt; tag and use data binding to set the <code>backgroundFill</code> property, as seen in the following example:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/11/16/setting-a-background-image-fill-on-a-spark-border-container-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Border_backgroundImage_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:BitmapFill</span> id=<span style="color: #ff0000;">&quot;fxFill&quot;</span> source=<span style="color: #ff0000;">&quot;@Embed('fx_appicon-tn.gif')&quot;</span> fillMode=<span style="color: #ff0000;">&quot;repeat&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Border</span> id=<span style="color: #ff0000;">&quot;brdr&quot;</span></span>
<span style="color: #000000;">            backgroundFill=<span style="color: #ff0000;">&quot;{fxFill}&quot;</span></span>
<span style="color: #000000;">            borderColor=<span style="color: #ff0000;">&quot;haloOrange&quot;</span></span>
<span style="color: #000000;">            borderWeight=<span style="color: #ff0000;">&quot;10&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;320&quot;</span> height=<span style="color: #ff0000;">&quot;240&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;sdkVer&quot;</span></span>
<span style="color: #000000;">                color=<span style="color: #ff0000;">&quot;haloOrange&quot;</span></span>
<span style="color: #000000;">                fontSize=<span style="color: #ff0000;">&quot;48&quot;</span></span>
<span style="color: #000000;">                fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span></span>
<span style="color: #000000;">                left=<span style="color: #ff0000;">&quot;20&quot;</span> top=<span style="color: #ff0000;">&quot;20&quot;</span></span>
<span style="color: #000000;">                creationComplete=<span style="color: #ff0000;">&quot;sdkVer.text = mx_internal::VERSION;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Border</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="alert">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.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting a background image fill on a Spark Border container in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/11/16/setting-a-background-image-fill-on-a-spark-border-container-in-flex-4/',contentID: 'post-2203',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'backgroundFill,backgroundImage,backgroundImageFillMode,Gumbo',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/11/16/setting-a-background-image-fill-on-a-spark-border-container-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

