<?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</title>
	<atom:link href="http://blog.flexexamples.com/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>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Setting the icon placement on a Spark Button control in Flex Hero</title>
		<link>http://blog.flexexamples.com/2010/12/18/setting-the-icon-placement-on-a-spark-button-control-in-flex-hero/</link>
		<comments>http://blog.flexexamples.com/2010/12/18/setting-the-icon-placement-on-a-spark-button-control-in-flex-hero/#comments</comments>
		<pubDate>Sat, 18 Dec 2010 17:47:39 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta]]></category>
		<category><![CDATA[Button (Spark)]]></category>
		<category><![CDATA[Hero]]></category>
		<category><![CDATA[icon]]></category>
		<category><![CDATA[iconPlacement]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=3471</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2010/12/17/setting-an-icon-on-a-spark-button-in-flex-hero/">&#8220;Setting an icon on a Spark Button in Flex Hero&#8221;</a>, we saw how you can set the icon on a Spark Button in Flex Hero by setting the icon style.</p> <p>The following example shows how you can set the icon placement on a Spark Button control in Flex Hero by [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2010/12/17/setting-an-icon-on-a-spark-button-in-flex-hero/">&#8220;Setting an icon on a Spark Button in Flex Hero&#8221;</a>, we saw how you can set the icon on a Spark Button in Flex Hero by setting the <code>icon</code> style.</p>
<p>The following example shows how you can set the icon placement on a Spark Button control in Flex Hero by setting the <code>iconPlacement</code> style.</p>
<p><span id="more-3471"></span></p>
<p>[HeroHeader]</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/2010/12/18/setting-the-icon-placement-on-a-spark-button-control-in-flex-hero/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Button_iconPlacement_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/mx&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VerticalLayout</span> horizontalAlign=<span style="color: #ff0000;">&quot;center&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</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;;
&nbsp;
        s|Button {
            icon: Embed(&quot;assets/asterisk_orange.png&quot;);
        }
    <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:Button</span> id=<span style="color: #ff0000;">&quot;btn1&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;iconPlacement=left&quot;</span></span>
<span style="color: #000000;">            iconPlacement=<span style="color: #ff0000;">&quot;left&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn2&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;iconPlacement=right&quot;</span></span>
<span style="color: #000000;">            iconPlacement=<span style="color: #ff0000;">&quot;right&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn3&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;iconPlacement=top&quot;</span></span>
<span style="color: #000000;">            iconPlacement=<span style="color: #ff0000;">&quot;top&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn4&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;iconPlacement=bottom&quot;</span></span>
<span style="color: #000000;">            iconPlacement=<span style="color: #ff0000;">&quot;bottom&quot;</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>iconPlacement</code> style 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/2010/12/18/setting-the-icon-placement-on-a-spark-button-control-in-flex-hero/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Button_iconPlacement_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/mx&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VerticalLayout</span> horizontalAlign=<span style="color: #ff0000;">&quot;center&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</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;;
&nbsp;
        s|Button {
            icon: Embed(&quot;assets/asterisk_orange.png&quot;);
        }
        s|Button#btn1 {
            iconPlacement: left;
        }
        s|Button#btn2 {
            iconPlacement: right;
        }
        s|Button#btn3 {
            iconPlacement: top;
        }
        s|Button#btn4 {
            iconPlacement: bottom;
        }
    <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:Button</span> id=<span style="color: #ff0000;">&quot;btn1&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;iconPlacement=left&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn2&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;iconPlacement=right&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn3&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;iconPlacement=top&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn4&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;iconPlacement=bottom&quot;</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>iconPlacement</code> style 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/2010/12/18/setting-the-icon-placement-on-a-spark-button-control-in-flex-hero/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Button_iconPlacement_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/mx&quot;</span></span>
<span style="color: #000000;">        initialize=<span style="color: #ff0000;">&quot;init();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VerticalLayout</span> horizontalAlign=<span style="color: #ff0000;">&quot;center&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</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;">            import spark.components.IconPlacement;</span>
&nbsp;
<span style="color: #000000;">            protected function init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                btn1.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;iconPlacement&quot;</span>, IconPlacement.LEFT<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                btn2.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;iconPlacement&quot;</span>, IconPlacement.RIGHT<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                btn3.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;iconPlacement&quot;</span>, IconPlacement.TOP<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                btn4.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;iconPlacement&quot;</span>, IconPlacement.BOTTOM<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:Style</span><span style="color: #7400FF;">&gt;</span></span>
        @namespace s &quot;library://ns.adobe.com/flex/spark&quot;;
&nbsp;
        s|Button {
            icon: Embed(&quot;assets/asterisk_orange.png&quot;);
        }
    <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:Button</span> id=<span style="color: #ff0000;">&quot;btn1&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;iconPlacement=left&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn2&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;iconPlacement=right&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn3&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;iconPlacement=top&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn4&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;iconPlacement=bottom&quot;</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>[HeroFooter]</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the icon placement on a Spark Button control in Flex Hero on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/12/18/setting-the-icon-placement-on-a-spark-button-control-in-flex-hero/',contentID: 'post-3471',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'Hero,icon,iconPlacement',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/2010/12/18/setting-the-icon-placement-on-a-spark-button-control-in-flex-hero/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Setting an icon on a Spark Button in Flex Hero</title>
		<link>http://blog.flexexamples.com/2010/12/17/setting-an-icon-on-a-spark-button-in-flex-hero/</link>
		<comments>http://blog.flexexamples.com/2010/12/17/setting-an-icon-on-a-spark-button-in-flex-hero/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 21:43:12 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta]]></category>
		<category><![CDATA[Button (Spark)]]></category>
		<category><![CDATA[Hero]]></category>
		<category><![CDATA[icon]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=3463</guid>
		<description><![CDATA[<p>The following example shows how you can set the icon on a Spark Button in Flex Hero by setting the icon style.</p> <p></p> <p>[HeroHeader]</p> <p class="note">The following example requires Flex SDK 4.5.0.18623 or later.</p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2010/12/17/setting-an-icon-on-a-spark-button-in-flex-hero/ --&#62; &#60;s:Application name=&#34;Spark_Button_icon_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/mx&#34;&#62; &#60;s:layout&#62; &#60;s:VerticalLayout horizontalAlign=&#34;center&#34; verticalAlign=&#34;middle&#34; /&#62; &#60;/s:layout&#62; &#160; &#60;fx:Script&#62; &#60;!&#91;CDATA&#91; &#91;Embed&#40;&#34;assets/asterisk_orange.png&#34;&#41;&#93; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the icon on a Spark Button in Flex Hero by setting the <code>icon</code> style.</p>
<p><span id="more-3463"></span></p>
<p>[HeroHeader]</p>
<p class="note">The following example requires Flex SDK 4.5.0.18623 or later.</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/2010/12/17/setting-an-icon-on-a-spark-button-in-flex-hero/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Button_icon_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/mx&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VerticalLayout</span> horizontalAlign=<span style="color: #ff0000;">&quot;center&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</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;assets/asterisk_orange.png&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></span>
<span style="color: #000000;">            protected const ICON: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:Button</span> label=<span style="color: #ff0000;">&quot;Spark Button with dynamic icon&quot;</span> icon=<span style="color: #ff0000;">&quot;assets/asterisk_orange.png&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;Spark Button with inline embedded icon&quot;</span> icon=<span style="color: #ff0000;">&quot;@Embed('assets/asterisk_orange.png')&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;Spark Button with metadata [Embed] icon&quot;</span> icon=<span style="color: #ff0000;">&quot;{ICON}&quot;</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>icon</code> style in the &lt;Style&gt; block or an external CSS file, 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/2010/12/17/setting-an-icon-on-a-spark-button-in-flex-hero/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Button_icon_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/mx&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VerticalLayout</span> horizontalAlign=<span style="color: #ff0000;">&quot;center&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</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;assets/asterisk_orange.png&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></span>
<span style="color: #000000;">            protected const ICON: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;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/mx&quot;;
&nbsp;
        s|Button#btn1 {
            icon: &quot;assets/asterisk_orange.png&quot;;
        }
&nbsp;
        s|Button#btn2 {
            icon: Embed(&quot;assets/asterisk_orange.png&quot;);
        }
&nbsp;
        s|Button#btn3 {
            icon: PropertyReference(&quot;ICON&quot;);
        }
    <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:Button</span> id=<span style="color: #ff0000;">&quot;btn1&quot;</span> label=<span style="color: #ff0000;">&quot;Spark Button with dynamic icon&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn2&quot;</span> label=<span style="color: #ff0000;">&quot;Spark Button with inline embedded icon&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn3&quot;</span> label=<span style="color: #ff0000;">&quot;Spark Button with metadata [Embed] icon&quot;</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>icon</code> property 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/2010/12/17/setting-an-icon-on-a-spark-button-in-flex-hero/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Button_icon_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/mx&quot;</span></span>
<span style="color: #000000;">        initialize=<span style="color: #ff0000;">&quot;init();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VerticalLayout</span> horizontalAlign=<span style="color: #ff0000;">&quot;center&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</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;assets/asterisk_orange.png&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></span>
<span style="color: #000000;">            protected const ICON:Class;</span>
&nbsp;
<span style="color: #000000;">            protected function init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                btn1.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;icon&quot;</span>, <span style="color: #ff0000;">&quot;assets/asterisk_orange.png&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                btn2.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;icon&quot;</span>, ICON<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;s:Button</span> id=<span style="color: #ff0000;">&quot;btn1&quot;</span> label=<span style="color: #ff0000;">&quot;Spark Button with dynamic icon&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn2&quot;</span> label=<span style="color: #ff0000;">&quot;Spark Button with an embedded icon&quot;</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>[HeroFooter]</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting an icon on a Spark Button in Flex Hero on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/12/17/setting-an-icon-on-a-spark-button-in-flex-hero/',contentID: 'post-3463',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'Hero,icon',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/2010/12/17/setting-an-icon-on-a-spark-button-in-flex-hero/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Setting a fixed button width on a Spark ButtonBar control in Flex 4</title>
		<link>http://blog.flexexamples.com/2010/12/10/setting-a-fixed-button-width-on-a-spark-buttonbar-control-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2010/12/10/setting-a-fixed-button-width-on-a-spark-buttonbar-control-in-flex-4/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 23:48:05 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ButtonBar (Spark)]]></category>
		<category><![CDATA[columnWidth]]></category>
		<category><![CDATA[variableColumnWidth]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=3460</guid>
		<description><![CDATA[<p>The following example shows how you can set a fixed button width on a Spark ButtonBar control in Flex 4 by creating a custom HorizontalLayout and setting the columnWidth and variableColumnWidth properties.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2010/12/10/setting-a-fixed-button-width-on-a-spark-buttonbar-control-in-flex-4/ --&#62; &#60;s:Application name=&#34;Spark_ButtonBar_layout_columnWidth_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/mx&#34;&#62; &#160; &#60;s:ButtonBar id=&#34;bBar&#34; horizontalCenter=&#34;0&#34; verticalCenter=&#34;0&#34;&#62; &#60;s:layout&#62; &#60;s:HorizontalLayout gap=&#34;-1&#34; columnWidth=&#34;80&#34; variableColumnWidth=&#34;false&#34; /&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set a fixed button width on a Spark ButtonBar control in Flex 4 by creating a custom HorizontalLayout and setting the <code>columnWidth</code> and <code>variableColumnWidth</code> properties.</p>
<p><span id="more-3460"></span></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/2010/12/10/setting-a-fixed-button-width-on-a-spark-buttonbar-control-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_ButtonBar_layout_columnWidth_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/mx&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ButtonBar</span> id=<span style="color: #ff0000;">&quot;bBar&quot;</span> 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:layout</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:HorizontalLayout</span> gap=<span style="color: #ff0000;">&quot;-1&quot;</span> columnWidth=<span style="color: #ff0000;">&quot;80&quot;</span> variableColumnWidth=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ArrayList</span> source=<span style="color: #ff0000;">&quot;[Red,Halo Orange,Yellow,Halo Green,Halo Blue,A,The quick brown fox]&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:ButtonBar</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>

<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting a fixed button width on a Spark ButtonBar control in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/12/10/setting-a-fixed-button-width-on-a-spark-buttonbar-control-in-flex-4/',contentID: 'post-3460',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'columnWidth,variableColumnWidth',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/2010/12/10/setting-a-fixed-button-width-on-a-spark-buttonbar-control-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Changing the label placement on an MX TabBar control in Flex</title>
		<link>http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-tabbar-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-tabbar-control-in-flex/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 02:41:44 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TabBar]]></category>
		<category><![CDATA[ClassFactory]]></category>
		<category><![CDATA[icon]]></category>
		<category><![CDATA[iconField]]></category>
		<category><![CDATA[labelField]]></category>
		<category><![CDATA[labelPlacement]]></category>
		<category><![CDATA[mx_internal]]></category>
		<category><![CDATA[navItemFactory]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=3436</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/">&#8220;Changing the label placement on an MX ButtonBar control in Flex (redux)&#8221;</a>, we saw how you could set the label/icon placement on an MX ButtonBar control in Flex by extending the MX ButtonBar class and setting the navItemFactory property in the mx_internal namespace to a custom class.</p> <p>The following example [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/">&#8220;Changing the label placement on an MX ButtonBar control in Flex (redux)&#8221;</a>, we saw how you could set the label/icon placement on an MX ButtonBar control in Flex by extending the MX ButtonBar class and setting the <code>navItemFactory</code> property in the  <code>mx_internal</code> namespace to a custom class.</p>
<p>The following example shows how you can set the label/icon placement on an MX TabBar control in Flex by extending the MX TabBar class and setting the <code>navItemFactory</code> property in the  <code>mx_internal</code> namespace to a custom Tab button class.</p>
<p><span id="more-3436"></span></p>
<p>[mx_internal]</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/2010/11/09/changing-the-label-placement-on-an-mx-tabbar-control-in-flex/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;MX_TabBar_navItemFactory_test&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        xmlns:comps=<span style="color: #ff0000;">&quot;comps.*&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;comps:CustomTabBar</span> id=<span style="color: #ff0000;">&quot;tb&quot;</span></span>
<span style="color: #000000;">            dataProvider=<span style="color: #ff0000;">&quot;{viewstack}&quot;</span></span>
<span style="color: #000000;">            labelField=<span style="color: #ff0000;">&quot;label&quot;</span></span>
<span style="color: #000000;">            iconField=<span style="color: #ff0000;">&quot;icon&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;300&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ViewStack</span> id=<span style="color: #ff0000;">&quot;viewstack&quot;</span></span>
<span style="color: #000000;">            backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;300&quot;</span> height=<span style="color: #ff0000;">&quot;100&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> id=<span style="color: #ff0000;">&quot;tab_1&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Tab 1&quot;</span></span>
<span style="color: #000000;">                icon=<span style="color: #ff0000;">&quot;@Embed('Assets.swf#CloseButtonUp')&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Canvas</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> id=<span style="color: #ff0000;">&quot;tab_2&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Tab 2&quot;</span></span>
<span style="color: #000000;">                icon=<span style="color: #ff0000;">&quot;@Embed('Assets.swf#CloseButtonOver')&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ColorPicker</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Canvas</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> id=<span style="color: #ff0000;">&quot;tab_3&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Tab 3&quot;</span></span>
<span style="color: #000000;">                icon=<span style="color: #ff0000;">&quot;@Embed('Assets.swf#CloseButtonOver')&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ComboBox</span> dataProvider=<span style="color: #ff0000;">&quot;[red,orange,yellow,green,blue]&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Canvas</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ViewStack</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>The custom MX TabBar control, <em>comps/CustomTabBar.as</em>, is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/** http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-tabbar-control-in-flex/ */</span>
<span style="color: #9900cc; font-weight: bold;">package</span> comps <span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>controls<span style="color: #000066; font-weight: bold;">.</span>TabBar<span style="color: #000066; font-weight: bold;">;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.</span>ClassFactory<span style="color: #000066; font-weight: bold;">;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.</span>mx_internal<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> CustomTabBar <span style="color: #0033ff; font-weight: bold;">extends</span> TabBar <span style="color: #000000;">&#123;</span>
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CustomTabBar<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
            mx_internal<span style="color: #000066; font-weight: bold;">::</span>navItemFactory = <span style="color: #0033ff; font-weight: bold;">new</span> ClassFactory<span style="color: #000000;">&#40;</span>CustomTab<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>And the custom nav item factory, <em>comps/CustomTab.as</em>, is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/** http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-tabbar-control-in-flex/ */</span>
<span style="color: #9900cc; font-weight: bold;">package</span> comps <span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>controls<span style="color: #000066; font-weight: bold;">.</span>tabBarClasses<span style="color: #000066; font-weight: bold;">.</span>Tab<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> CustomTab <span style="color: #0033ff; font-weight: bold;">extends</span> Tab <span style="color: #000000;">&#123;</span>
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CustomTab<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
            labelPlacement = <span style="color: #990000;">&quot;top&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Changing the label placement on an MX TabBar control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-tabbar-control-in-flex/',contentID: 'post-3436',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'ClassFactory,icon,iconField,labelField,labelPlacement,mx_internal,navItemFactory',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/2010/11/09/changing-the-label-placement-on-an-mx-tabbar-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Changing the label placement on an MX ButtonBar control in Flex (redux)</title>
		<link>http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/</link>
		<comments>http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 02:23:51 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ButtonBar]]></category>
		<category><![CDATA[iconField]]></category>
		<category><![CDATA[labelField]]></category>
		<category><![CDATA[labelPlacement]]></category>
		<category><![CDATA[mx_internal]]></category>
		<category><![CDATA[navItemFactory]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=3433</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/01/08/changing-the-label-placement-for-a-flex-buttonbar-control/">&#8220;Changing the label placement for a Flex ButtonBar control&#8221;</a>, we saw how you could change the button&#8217;s label placement relative to its icon in a ButtonBar control in Flex by using the getChildAt() method and labelPlacement property.</p> <p>The following example shows how you can set the label/icon placement on an [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/01/08/changing-the-label-placement-for-a-flex-buttonbar-control/">&#8220;Changing the label placement for a Flex ButtonBar control&#8221;</a>, we saw how you could change the button&#8217;s label placement relative to its icon in a ButtonBar control in Flex by using the <code>getChildAt()</code> method and <code>labelPlacement</code> property.</p>
<p>The following example shows how you can set the label/icon placement on an MX ButtonBar control in Flex by extending the MX ButtonBar class and setting the <code>navItemFactory</code> property in the  <code>mx_internal</code> namespace to a custom class.</p>
<p><span id="more-3433"></span></p>
<p>[mx_internal]</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/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;MX_ButtonBar_navItemFactory_test&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        xmlns:local=<span style="color: #ff0000;">&quot;*&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;local:CustomButtonBar</span> id=<span style="color: #ff0000;">&quot;bb&quot;</span></span>
<span style="color: #000000;">            dataProvider=<span style="color: #ff0000;">&quot;{viewstack}&quot;</span></span>
<span style="color: #000000;">            labelField=<span style="color: #ff0000;">&quot;label&quot;</span></span>
<span style="color: #000000;">            iconField=<span style="color: #ff0000;">&quot;icon&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;300&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ViewStack</span> id=<span style="color: #ff0000;">&quot;viewstack&quot;</span></span>
<span style="color: #000000;">            backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;300&quot;</span> height=<span style="color: #ff0000;">&quot;100&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> id=<span style="color: #ff0000;">&quot;tab_1&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Tab 1&quot;</span></span>
<span style="color: #000000;">                icon=<span style="color: #ff0000;">&quot;@Embed('Assets.swf#CloseButtonUp')&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Canvas</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> id=<span style="color: #ff0000;">&quot;tab_2&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Tab 2&quot;</span></span>
<span style="color: #000000;">                icon=<span style="color: #ff0000;">&quot;@Embed('Assets.swf#CloseButtonOver')&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ColorPicker</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Canvas</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> id=<span style="color: #ff0000;">&quot;tab_3&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Tab 3&quot;</span></span>
<span style="color: #000000;">                icon=<span style="color: #ff0000;">&quot;@Embed('Assets.swf#CloseButtonOver')&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ComboBox</span> dataProvider=<span style="color: #ff0000;">&quot;[red,orange,yellow,green,blue]&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Canvas</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ViewStack</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>The custom MX ButtonBar control, <em>CustomButtonBar.as</em>, is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/** http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/ */</span>
<span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>controls<span style="color: #000066; font-weight: bold;">.</span>ButtonBar<span style="color: #000066; font-weight: bold;">;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.</span>ClassFactory<span style="color: #000066; font-weight: bold;">;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.</span>mx_internal<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> CustomButtonBar <span style="color: #0033ff; font-weight: bold;">extends</span> ButtonBar <span style="color: #000000;">&#123;</span>
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CustomButtonBar<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
            mx_internal<span style="color: #000066; font-weight: bold;">::</span>navItemFactory = <span style="color: #0033ff; font-weight: bold;">new</span> ClassFactory<span style="color: #000000;">&#40;</span>CustomButtonBarButton<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>And the custom nav item factory, <em>CustomButtonBarButton.as</em>, is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/** http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/ */</span>
<span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>controls<span style="color: #000066; font-weight: bold;">.</span>buttonBarClasses<span style="color: #000066; font-weight: bold;">.</span>ButtonBarButton<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> CustomButtonBarButton <span style="color: #0033ff; font-weight: bold;">extends</span> ButtonBarButton <span style="color: #000000;">&#123;</span>
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CustomButtonBarButton<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
            labelPlacement = <span style="color: #990000;">&quot;top&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Changing the label placement on an MX ButtonBar control in Flex (redux) on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/',contentID: 'post-3433',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'iconField,labelField,labelPlacement,mx_internal,navItemFactory',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/2010/11/09/changing-the-label-placement-on-an-mx-buttonbar-control-in-flex-redux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting a custom icon on the MX Button control in Flex</title>
		<link>http://blog.flexexamples.com/2010/11/08/setting-a-custom-icon-on-the-mx-button-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2010/11/08/setting-a-custom-icon-on-the-mx-button-control-in-flex/#comments</comments>
		<pubDate>Mon, 08 Nov 2010 20:27:35 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Button]]></category>
		<category><![CDATA[disabledIcon]]></category>
		<category><![CDATA[disabledSkin]]></category>
		<category><![CDATA[downIcon]]></category>
		<category><![CDATA[downSkin]]></category>
		<category><![CDATA[icon]]></category>
		<category><![CDATA[overIcon]]></category>
		<category><![CDATA[overSkin]]></category>
		<category><![CDATA[styleName]]></category>
		<category><![CDATA[upIcon]]></category>
		<category><![CDATA[upSkin]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=3427</guid>
		<description><![CDATA[<p>The following example shows how you can use the MX TitleWindow container&#8217;s close button for an MX Button control icon and skin by setting the skinClass style.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2010/11/08/setting-a-custom-icon-on-the-mx-button-control-in-flex/ --&#62; &#60;mx:Application name=&#34;MX_Button_upIcon_test&#34; xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34;&#62; &#160; &#60;mx:Style&#62; .titleWindowIconAsIcon { upIcon: Embed(&#34;Assets.swf#CloseButtonUp&#34;); overIcon: Embed(&#34;Assets.swf#CloseButtonOver&#34;); downIcon: Embed(&#34;Assets.swf#CloseButtonDown&#34;); disabledIcon: Embed(&#34;Assets.swf#CloseButtonDisabled&#34;); } &#160; .titleWindowIconAsSkin [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can use the MX TitleWindow container&#8217;s close button for an MX Button control icon and skin by setting the <code>skinClass</code> style.</p>
<p><span id="more-3427"></span></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/2010/11/08/setting-a-custom-icon-on-the-mx-button-control-in-flex/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;MX_Button_upIcon_test&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        .titleWindowIconAsIcon {
            upIcon: Embed(&quot;Assets.swf#CloseButtonUp&quot;);
            overIcon: Embed(&quot;Assets.swf#CloseButtonOver&quot;);
            downIcon: Embed(&quot;Assets.swf#CloseButtonDown&quot;);
            disabledIcon: Embed(&quot;Assets.swf#CloseButtonDisabled&quot;);
        }
&nbsp;
        .titleWindowIconAsSkin {
            upSkin: Embed(&quot;Assets.swf#CloseButtonUp&quot;);
            overSkin: Embed(&quot;Assets.swf#CloseButtonOver&quot;);
            downSkin: Embed(&quot;Assets.swf#CloseButtonDown&quot;);
            disabledSkin: Embed(&quot;Assets.swf#CloseButtonDisabled&quot;);
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> styleName=<span style="color: #ff0000;">&quot;titleWindowIconAsIcon&quot;</span> label=<span style="color: #ff0000;">&quot;Button&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> styleName=<span style="color: #ff0000;">&quot;titleWindowIconAsSkin&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting a custom icon on the MX Button control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/11/08/setting-a-custom-icon-on-the-mx-button-control-in-flex/',contentID: 'post-3427',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'disabledIcon,disabledSkin,downIcon,downSkin,icon,overIcon,overSkin,styleName,upIcon,upSkin',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/2010/11/08/setting-a-custom-icon-on-the-mx-button-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding scroll bars to an Spark Application container in Flex 4</title>
		<link>http://blog.flexexamples.com/2010/11/03/adding-scroll-bars-to-an-spark-application-container-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2010/11/03/adding-scroll-bars-to-an-spark-application-container-in-flex-4/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 23:55:09 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Application (Spark)]]></category>
		<category><![CDATA[Flex4]]></category>
		<category><![CDATA[Scroller (Spark)]]></category>
		<category><![CDATA[skinClass]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=3419</guid>
		<description><![CDATA[<p>The following example shows how you can add scroll bars to a Spark Application container in Flex 4 by creating a custom skin, adding a Spark Scroller container around the contentGroup skin part, and setting the skinClass style on the Application tag.</p> <p></p> <p>[GumboHeader]</p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2010/11/03/adding-scroll-bars-to-an-spark-application-container-in-flex-4/ --&#62; &#60;s:Application name=&#34;Spark_Application_Scroller_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/mx&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can add scroll bars to a Spark Application container in Flex 4 by creating a custom skin, adding a Spark Scroller container around the <code>contentGroup</code> skin part, and setting the <code>skinClass</code> style on the Application tag.</p>
<p><span id="more-3419"></span></p>
<p>[GumboHeader]</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/2010/11/03/adding-scroll-bars-to-an-spark-application-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_Application_Scroller_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/mx&quot;</span></span>
<span style="color: #000000;">        skinClass=<span style="color: #ff0000;">&quot;skins.CustomScrollingApplicationSkin&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:Label</span> text=<span style="color: #ff0000;">&quot;Rect height (px):&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:HSlider</span> id=<span style="color: #ff0000;">&quot;sl&quot;</span> minimum=<span style="color: #ff0000;">&quot;100&quot;</span> maximum=<span style="color: #ff0000;">&quot;1000&quot;</span> value=<span style="color: #ff0000;">&quot;300&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;s:Rect</span> top=<span style="color: #ff0000;">&quot;20&quot;</span> horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> width=<span style="color: #ff0000;">&quot;50%&quot;</span> height=<span style="color: #ff0000;">&quot;{sl.value}&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:LinearGradient</span> rotation=<span style="color: #ff0000;">&quot;45&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;red&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;haloOrange&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;yellow&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;haloGreen&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;haloBlue&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:LinearGradient</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</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>And the custom skin class, <em>skins/CustomScrollingApplicationSkin.mxml</em>, is as follows:</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/2010/11/03/adding-scroll-bars-to-an-spark-application-container-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Skin</span> name=<span style="color: #ff0000;">&quot;CustomScrollingApplicationSkin&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:fb=<span style="color: #ff0000;">&quot;http://ns.adobe.com/flashbuilder/2009&quot;</span></span>
<span style="color: #000000;">        alpha.disabledStates=<span style="color: #ff0000;">&quot;0.5&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- states --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:states</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;normal&quot;</span> stateGroups=<span style="color: #ff0000;">&quot;normalStates&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;disabled&quot;</span> stateGroups=<span style="color: #ff0000;">&quot;disabledStates&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;normalWithControlBar&quot;</span> stateGroups=<span style="color: #ff0000;">&quot;normalStates&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;disabledWithControlBar&quot;</span> stateGroups=<span style="color: #ff0000;">&quot;disabledStates&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:states</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Metadata</span><span style="color: #7400FF;">&gt;</span></span>
        [HostComponent(&quot;spark.components.Application&quot;)]
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Metadata</span><span style="color: #7400FF;">&gt;</span></span> 
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span> fb:purpose=<span style="color: #ff0000;">&quot;styling&quot;</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;">            override protected function updateDisplayList<span style="color: #66cc66;">&#40;</span>unscaledWidth:Number, unscaledHeight:Number<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                bgRectFill.color = getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'backgroundColor'</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                bgRectFill.alpha = getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'backgroundAlpha'</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                super.updateDisplayList<span style="color: #66cc66;">&#40;</span>unscaledWidth, unscaledHeight<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: #808080; font-style: italic;">&lt;!-- fill --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!--- </span>
<span style="color: #000000;">    A rectangle with a solid color fill that forms the background of the application.</span>
<span style="color: #000000;">    The color of the fill is set to the Application's backgroundColor property.</span>
<span style="color: #000000;">    --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> id=<span style="color: #ff0000;">&quot;backgroundRect&quot;</span> left=<span style="color: #ff0000;">&quot;0&quot;</span> right=<span style="color: #ff0000;">&quot;0&quot;</span> top=<span style="color: #ff0000;">&quot;0&quot;</span> bottom=<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:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> id=<span style="color: #ff0000;">&quot;bgRectFill&quot;</span> color=<span style="color: #ff0000;">&quot;#FFFFFF&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Group</span> left=<span style="color: #ff0000;">&quot;0&quot;</span> right=<span style="color: #ff0000;">&quot;0&quot;</span> top=<span style="color: #ff0000;">&quot;0&quot;</span> bottom=<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:layout</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VerticalLayout</span> gap=<span style="color: #ff0000;">&quot;0&quot;</span> horizontalAlign=<span style="color: #ff0000;">&quot;justify&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
        <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!--- Application Control Bar --&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Group</span> id=<span style="color: #ff0000;">&quot;topGroup&quot;</span> minWidth=<span style="color: #ff0000;">&quot;0&quot;</span> minHeight=<span style="color: #ff0000;">&quot;0&quot;</span></span>
<span style="color: #000000;">                 includeIn=<span style="color: #ff0000;">&quot;normalWithControlBar, disabledWithControlBar&quot;</span> <span style="color: #7400FF;">&gt;</span></span>
&nbsp;
            <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- layer 0: control bar highlight --&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> left=<span style="color: #ff0000;">&quot;0&quot;</span> right=<span style="color: #ff0000;">&quot;0&quot;</span> top=<span style="color: #ff0000;">&quot;0&quot;</span> bottom=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:stroke</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:LinearGradientStroke</span> rotation=<span style="color: #ff0000;">&quot;90&quot;</span> weight=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;0xFFFFFF&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;0xD8D8D8&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:LinearGradientStroke</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:stroke</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
            <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- layer 1: control bar fill --&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> left=<span style="color: #ff0000;">&quot;1&quot;</span> right=<span style="color: #ff0000;">&quot;1&quot;</span> top=<span style="color: #ff0000;">&quot;1&quot;</span> bottom=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:LinearGradient</span> rotation=<span style="color: #ff0000;">&quot;90&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;0xEDEDED&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:GradientEntry</span> color=<span style="color: #ff0000;">&quot;0xCDCDCD&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:LinearGradient</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
            <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- layer 2: control bar divider line --&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> left=<span style="color: #ff0000;">&quot;0&quot;</span> right=<span style="color: #ff0000;">&quot;0&quot;</span> bottom=<span style="color: #ff0000;">&quot;0&quot;</span> height=<span style="color: #ff0000;">&quot;1&quot;</span> alpha=<span style="color: #ff0000;">&quot;0.55&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> color=<span style="color: #ff0000;">&quot;0x000000&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
            <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- layer 3: control bar --&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Group</span> id=<span style="color: #ff0000;">&quot;controlBarGroup&quot;</span> left=<span style="color: #ff0000;">&quot;0&quot;</span> right=<span style="color: #ff0000;">&quot;0&quot;</span> top=<span style="color: #ff0000;">&quot;1&quot;</span> bottom=<span style="color: #ff0000;">&quot;1&quot;</span> minWidth=<span style="color: #ff0000;">&quot;0&quot;</span> minHeight=<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:layout</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:HorizontalLayout</span> paddingLeft=<span style="color: #ff0000;">&quot;10&quot;</span> paddingRight=<span style="color: #ff0000;">&quot;10&quot;</span> paddingTop=<span style="color: #ff0000;">&quot;7&quot;</span> paddingBottom=<span style="color: #ff0000;">&quot;7&quot;</span> gap=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Group</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Group</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Scroller</span> id=<span style="color: #ff0000;">&quot;contentScroller&quot;</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span> minWidth=<span style="color: #ff0000;">&quot;0&quot;</span> minHeight=<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:Group</span> id=<span style="color: #ff0000;">&quot;contentGroup&quot;</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span> minWidth=<span style="color: #ff0000;">&quot;0&quot;</span> minHeight=<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:Scroller</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Group</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Skin</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>[GumboFooter]</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Adding scroll bars to an Spark Application container in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/11/03/adding-scroll-bars-to-an-spark-application-container-in-flex-4/',contentID: 'post-3419',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'skinClass',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/2010/11/03/adding-scroll-bars-to-an-spark-application-container-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Clearing a style on the Spark Button control in Flex 4</title>
		<link>http://blog.flexexamples.com/2010/10/27/clearing-a-style-on-the-spark-button-control-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2010/10/27/clearing-a-style-on-the-spark-button-control-in-flex-4/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 17:22:51 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Button (Spark)]]></category>
		<category><![CDATA[Flex4]]></category>
		<category><![CDATA[clearStyle()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=3414</guid>
		<description><![CDATA[<p>The following example shows how you can clear a style on the Spark Button control in Flex 4 by using the clearStyle() method.</p> <p></p> <p>[GumboHeader]</p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2010/10/27/clearing-a-style-on-the-spark-button-control-in-flex-4/ --&#62; &#60;s:Application name=&#34;Spark_Button_clearStyle_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/mx&#34;&#62; &#60;s:controlBarContent&#62; &#60;s:Button label=&#34;bold&#34; fontWeight=&#34;bold&#34; click=&#34;btn.setStyle('fontWeight', FontWeight.BOLD);&#34; /&#62; &#60;s:Button label=&#34;no bold&#34; click=&#34;btn.clearStyle('fontWeight');&#34; /&#62; &#60;/s:controlBarContent&#62; &#160; &#60;fx:Script&#62; &#60;!&#91;CDATA&#91; import flash.text.engine.FontWeight; &#93;&#93;&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can clear a style on the Spark Button control in Flex 4 by using the <code>clearStyle()</code> method.</p>
<p><span id="more-3414"></span></p>
<p>[GumboHeader]</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/2010/10/27/clearing-a-style-on-the-spark-button-control-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_Button_clearStyle_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/mx&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;bold&quot;</span> fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span> click=<span style="color: #ff0000;">&quot;btn.setStyle('fontWeight', FontWeight.BOLD);&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;no bold&quot;</span> click=<span style="color: #ff0000;">&quot;btn.clearStyle('fontWeight');&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;">            import flash.text.engine.FontWeight;</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:Button</span> id=<span style="color: #ff0000;">&quot;btn&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;Button&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>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>[GumboFooter]</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Clearing a style on the Spark Button control in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/10/27/clearing-a-style-on-the-spark-button-control-in-flex-4/',contentID: 'post-3414',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'clearStyle()',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/2010/10/27/clearing-a-style-on-the-spark-button-control-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setting multiple style names on a Spark Button control in Flex 4</title>
		<link>http://blog.flexexamples.com/2010/10/27/setting-multiple-style-names-on-a-spark-button-control-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2010/10/27/setting-multiple-style-names-on-a-spark-button-control-in-flex-4/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 16:59:01 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Button (Spark)]]></category>
		<category><![CDATA[Flex4]]></category>
		<category><![CDATA[styleName]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=3410</guid>
		<description><![CDATA[<p>The following example shows how you can define multiple style names on a Spark Button control in Flex 4 by setting the styleName property to a space separated list of CSS style names.</p> <p></p> <p>[GumboHeader]</p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2010/10/27/setting-multiple-style-names-on-a-spark-button-control-in-flex-4/ --&#62; &#60;s:Application name=&#34;Spark_Button_styleName_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/mx&#34;&#62; &#60;s:layout&#62; &#60;s:HorizontalLayout horizontalAlign=&#34;center&#34; verticalAlign=&#34;middle&#34; /&#62; &#60;/s:layout&#62; &#160; &#60;fx:Style&#62; .boldWeight [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can define multiple style names on a Spark Button control in Flex 4 by setting the <code>styleName</code> property to a space separated list of CSS style names.</p>
<p><span id="more-3410"></span></p>
<p>[GumboHeader]</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/2010/10/27/setting-multiple-style-names-on-a-spark-button-control-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_Button_styleName_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/mx&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:HorizontalLayout</span> horizontalAlign=<span style="color: #ff0000;">&quot;center&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</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>
        .boldWeight {
            fontWeight: bold;
        }
        .redColor {
            color: red;
        }
    <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:Button</span> id=<span style="color: #ff0000;">&quot;btn1&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;MXML&quot;</span></span>
<span style="color: #000000;">            styleName=<span style="color: #ff0000;">&quot;redColor boldWeight&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn2&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;ActionScript (click)&quot;</span></span>
<span style="color: #000000;">            toolTip=<span style="color: #ff0000;">&quot;Click to apply styles&quot;</span></span>
<span style="color: #000000;">            click=<span style="color: #ff0000;">&quot;btn2.styleName = 'redColor boldWeight';&quot;</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>[GumboFooter]</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting multiple style names on a Spark Button control in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/10/27/setting-multiple-style-names-on-a-spark-button-control-in-flex-4/',contentID: 'post-3410',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'styleName',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/2010/10/27/setting-multiple-style-names-on-a-spark-button-control-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Setting a background fill on an invalid Spark Image control in Flex Hero</title>
		<link>http://blog.flexexamples.com/2010/10/25/setting-a-background-fill-on-an-invalid-spark-image-control-in-flex-hero/</link>
		<comments>http://blog.flexexamples.com/2010/10/25/setting-a-background-fill-on-an-invalid-spark-image-control-in-flex-hero/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 01:15:31 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Image (Spark)]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[BitmapFill]]></category>
		<category><![CDATA[Hero]]></category>
		<category><![CDATA[invalid]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=3407</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2010/10/25/setting-the-background-color-on-an-invalid-spark-image-control-in-flex-hero/">&#8220;Setting the background color on an invalid Spark Image control in Flex Hero&#8221;</a>, we saw how you could set the background color on an invalid Spark Image control in Flex Hero by setting the backgroundColor style on the invalid skin state.</p> <p>The following example shows how you can create a [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2010/10/25/setting-the-background-color-on-an-invalid-spark-image-control-in-flex-hero/">&#8220;Setting the background color on an invalid Spark Image control in Flex Hero&#8221;</a>, we saw how you could set the background color on an invalid Spark Image control in Flex Hero by setting the <code>backgroundColor</code> style on the <code>invalid</code> skin state.</p>
<p>The following example shows how you can create a custom bitmap fill on a Spark Image control in Flex Hero by creating a custom skin class and creating a BitmapFill object in the <code>invalid</code> skin state for the <code>background</code> skin part.</p>
<p><span id="more-3407"></span></p>
<p>[HeroHeader]</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/2010/10/25/setting-a-background-fill-on-an-invalid-spark-image-control-in-flex-hero/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Image_skinClass_invalid_BitmapFill_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/mx&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:Form</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:FormItem</span> label=<span style="color: #ff0000;">&quot;source:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:HorizontalLayout</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</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;image1.jpg&quot;</span></span>
<span style="color: #000000;">                        click=<span style="color: #ff0000;">&quot;img.source = 'http://helpexamples.com/flash/images/image1.jpg';&quot;</span></span>
<span style="color: #000000;">                        chromeColor=<span style="color: #ff0000;">&quot;haloGreen&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;logo&quot;</span></span>
<span style="color: #000000;">                        click=<span style="color: #ff0000;">&quot;img.source = 'http://helpexamples.com/flash/images/logo.png';&quot;</span></span>
<span style="color: #000000;">                        chromeColor=<span style="color: #ff0000;">&quot;haloGreen&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;(404)&quot;</span></span>
<span style="color: #000000;">                        click=<span style="color: #ff0000;">&quot;img.source = 'http://helpexamples.com/flash/images/404.gif';&quot;</span></span>
<span style="color: #000000;">                        chromeColor=<span style="color: #ff0000;">&quot;red&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;(null)&quot;</span></span>
<span style="color: #000000;">                        click=<span style="color: #ff0000;">&quot;img.source = null;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Form</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: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/mx&quot;;
&nbsp;
        s|Image {
            backgroundColor: white;
        }
    <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:Image</span> id=<span style="color: #ff0000;">&quot;img&quot;</span></span>
<span style="color: #000000;">             width=<span style="color: #ff0000;">&quot;200&quot;</span> height=<span style="color: #ff0000;">&quot;200&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>
<span style="color: #000000;">             skinClass=<span style="color: #ff0000;">&quot;skins.CustomImageSkin&quot;</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>And the custom Spark Image skin class, <em>skins/CustomImageSkin.mxml</em>, is as follows:</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/2010/10/25/setting-a-background-fill-on-an-invalid-spark-image-control-in-flex-hero/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Skin</span> name=<span style="color: #ff0000;">&quot;CustomImageSkin&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:fb=<span style="color: #ff0000;">&quot;http://ns.adobe.com/flashbuilder/2009&quot;</span></span>
<span style="color: #000000;">        alpha.disabled=<span style="color: #ff0000;">&quot;0.5&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- states --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:states</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;uninitialized&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;loading&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;ready&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;invalid&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;disabled&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:states</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- host component --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Metadata</span><span style="color: #7400FF;">&gt;</span></span>
        [HostComponent(&quot;spark.components.Image&quot;)]
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Metadata</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span> fb:purpose=<span style="color: #ff0000;">&quot;styling&quot;</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;">            override protected function updateDisplayList<span style="color: #66cc66;">&#40;</span>unscaledWidth:Number, unscaledHeight:Number<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                // Push backgroundColor and backgroundAlpha directly.</span>
<span style="color: #000000;">                // Handle undefined backgroundColor by hiding the background object.</span>
<span style="color: #000000;">                if <span style="color: #66cc66;">&#40;</span>isNaN<span style="color: #66cc66;">&#40;</span>getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;backgroundColor&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    background.visible = false;</span>
<span style="color: #000000;">                    background.includeInLayout = false;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span> else <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    background.visible = true;</span>
<span style="color: #000000;">                    background.includeInLayout = true;</span>
<span style="color: #000000;">                    bgFill.color = getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;backgroundColor&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                    bgFill.alpha = getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;backgroundAlpha&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">                super.updateDisplayList<span style="color: #66cc66;">&#40;</span>unscaledWidth, unscaledHeight<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: #808080; font-style: italic;">&lt;!-- Defines the appearance of the image background. --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> id=<span style="color: #ff0000;">&quot;background&quot;</span> left=<span style="color: #ff0000;">&quot;0&quot;</span> right=<span style="color: #ff0000;">&quot;0&quot;</span> top=<span style="color: #ff0000;">&quot;0&quot;</span> bottom=<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:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> id=<span style="color: #ff0000;">&quot;bgFill&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span>.invalid<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('skins/stripe.png')&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:fill</span>.invalid<span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- Primary image display part --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:BitmapImage</span> id=<span style="color: #ff0000;">&quot;imageDisplay&quot;</span></span>
<span style="color: #000000;">            left=<span style="color: #ff0000;">&quot;0&quot;</span> top=<span style="color: #ff0000;">&quot;0&quot;</span> right=<span style="color: #ff0000;">&quot;0&quot;</span> bottom=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- Progress indicator part --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Range</span> id=<span style="color: #ff0000;">&quot;progressIndicator&quot;</span></span>
<span style="color: #000000;">            skinClass=<span style="color: #ff0000;">&quot;spark.skins.spark.ImageLoadingSkin&quot;</span></span>
<span style="color: #000000;">            includeIn=<span style="color: #ff0000;">&quot;loading&quot;</span></span>
<span style="color: #000000;">            layoutDirection=<span style="color: #ff0000;">&quot;ltr&quot;</span></span>
<span style="color: #000000;">            verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- Invalid image icon --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:BitmapImage</span> source=<span style="color: #ff0000;">&quot;@Embed('Assets.swf#__brokenImage')&quot;</span></span>
<span style="color: #000000;">            includeIn=<span style="color: #ff0000;">&quot;invalid&quot;</span></span>
<span style="color: #000000;">            verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Skin</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>[HeroFooter]</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting a background fill on an invalid Spark Image control in Flex Hero on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/10/25/setting-a-background-fill-on-an-invalid-spark-image-control-in-flex-hero/',contentID: 'post-3407',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'background,BitmapFill,Hero,invalid',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/2010/10/25/setting-a-background-fill-on-an-invalid-spark-image-control-in-flex-hero/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

