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

<channel>
	<title>Flex Examples &#187; rotation</title>
	<atom:link href="http://blog.flexexamples.com/tag/rotation/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting a gradient background fill on a Spark TextArea control in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/10/24/setting-a-gradient-background-fill-on-a-spark-textarea-control-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2009/10/24/setting-a-gradient-background-fill-on-a-spark-textarea-control-in-flex-4/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 22:44:20 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta2]]></category>
		<category><![CDATA[TextArea (Spark)]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[entries]]></category>
		<category><![CDATA[fill]]></category>
		<category><![CDATA[GradientEntry]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[lineargradient]]></category>
		<category><![CDATA[rotation]]></category>
		<category><![CDATA[skin]]></category>
		<category><![CDATA[skinClass]]></category>
		<category><![CDATA[TextAreaSkin]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=2079</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2009/10/24/setting-a-gradient-background-fill-on-a-halo-textarea-control-in-flex-4/">&#8220;Setting a gradient background fill on a Halo TextArea control in Flex 4&#8243;</a>, we saw how you could create a linear gradient background on a Halo/MX TextArea control in Flex 4 by creating a custom border skin with a LinearGradient fill and setting the borderSkin style.</p> <p>The following example shows [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2009/10/24/setting-a-gradient-background-fill-on-a-halo-textarea-control-in-flex-4/">&#8220;Setting a gradient background fill on a Halo TextArea control in Flex 4&#8243;</a>, we saw how you could create a linear gradient background on a Halo/MX TextArea control in Flex 4 by creating a custom border skin with a LinearGradient fill and setting the <code>borderSkin</code> style.</p>
<p>The following example shows how you can create a linear gradient background on a Spark TextArea control in Flex 4 by modifying the background fill in the TextArea control&#8217;s skin to a LinearGradient.</p>
<p>Full code after the jump.</p>
<p><span id="more-2079"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/10/24/setting-a-gradient-background-fill-on-a-spark-textarea-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_TextArea_skin_background_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Set TextArea background gradient&quot;</span></span>
<span style="color: #000000;">                click=<span style="color: #ff0000;">&quot;btn_click(event);&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 mx.graphics.GradientEntry;</span>
<span style="color: #000000;">            import mx.graphics.LinearGradient;</span>
<span style="color: #000000;">            import mx.utils.ObjectUtil;</span>
<span style="color: #000000;">            import spark.skins.spark.TextAreaSkin;</span>
&nbsp;
<span style="color: #000000;">            protected function btn_click<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var grad1:GradientEntry = new GradientEntry<span style="color: #66cc66;">&#40;</span>0xFF0000<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                var grad2:GradientEntry = new GradientEntry<span style="color: #66cc66;">&#40;</span>0xFF00FF<span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                var linearGrad:LinearGradient = new LinearGradient<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                linearGrad.entries = <span style="color: #66cc66;">&#91;</span>grad1, grad2<span style="color: #66cc66;">&#93;</span>;</span>
<span style="color: #000000;">                linearGrad.rotation = <span style="color: #cc66cc;">90</span>;</span>
&nbsp;
<span style="color: #000000;">                TextAreaSkin<span style="color: #66cc66;">&#40;</span>ta.skin<span style="color: #66cc66;">&#41;</span>.background.fill = linearGrad;</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:TextArea</span> id=<span style="color: #ff0000;">&quot;ta&quot;</span></span>
<span style="color: #000000;">            text=<span style="color: #ff0000;">&quot;{Capabilities.serverString}&quot;</span></span>
<span style="color: #000000;">            verticalScrollPolicy=<span style="color: #ff0000;">&quot;on&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 class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_TextArea_skin_background_test/bin/srcview/">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_TextArea_skin_background_test/bin/main.html" width="100%" height="250"></iframe></p>
<div span="googleAdsLeaderboard">
<script type="text/javascript"><!--
google_ad_client = "pub-3325829455487492";
/* 728x90, created 7/15/09 */
google_ad_slot = "6403511741";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br />
</div>
<p>You can also set the background fill to a gradient using a custom TextArea skin and then set the <code>skinClass</code> style, as seen in the following example:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/10/24/setting-a-gradient-background-fill-on-a-spark-textarea-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_TextArea_skin_background_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextArea</span> id=<span style="color: #ff0000;">&quot;ta&quot;</span></span>
<span style="color: #000000;">            text=<span style="color: #ff0000;">&quot;{Capabilities.serverString}&quot;</span></span>
<span style="color: #000000;">            skinClass=<span style="color: #ff0000;">&quot;skins.CustomTextAreaSkin&quot;</span></span>
<span style="color: #000000;">            verticalScrollPolicy=<span style="color: #ff0000;">&quot;on&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>And the custom Spark TextArea skin, <em>skins/CustomTextAreaSkin.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;!--  --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SparkSkin</span> name=<span style="color: #ff0000;">&quot;CustomTextAreaSkin&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>
<span style="color: #000000;">        blendMode=<span style="color: #ff0000;">&quot;normal&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>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;normal&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: #7400FF;">&lt;fx:Metadata</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>HostComponent<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;spark.components.TextArea&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</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: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;">            private var paddingChanged:Boolean;</span>
&nbsp;
<span style="color: #000000;">            /* Define the skin elements that should not be colorized.</span>
<span style="color: #000000;">            For text area, the skin itself is colorized but the individual parts are not. */</span>
<span style="color: #000000;">            static private const exclusions:Array = <span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;background&quot;</span>, <span style="color: #ff0000;">&quot;scroller&quot;</span><span style="color: #66cc66;">&#93;</span>;</span>
&nbsp;
<span style="color: #000000;">            override public function get colorizeExclusions<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:Array <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                return exclusions;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            /* Define the content fill items that should be colored by the <span style="color: #ff0000;">&quot;contentBackgroundColor&quot;</span> style. */</span>
<span style="color: #000000;">            static private const contentFill:Array = <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;</span>
&nbsp;
<span style="color: #000000;">            override public function get contentItems<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:Array <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                return contentFill</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span>;</span>
&nbsp;
<span style="color: #000000;">            override protected function commitProperties<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                super.commitProperties<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                if <span style="color: #66cc66;">&#40;</span>paddingChanged<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    updatePadding<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                    paddingChanged = false;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            override protected function initializationComplete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                useBaseColor = true;</span>
<span style="color: #000000;">                super.initializationComplete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<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;">                if <span style="color: #66cc66;">&#40;</span>getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;borderVisible&quot;</span><span style="color: #66cc66;">&#41;</span> == true<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    border.visible = true;</span>
<span style="color: #000000;">                    shadow.visible = true;</span>
<span style="color: #000000;">                    background.left = background.top = background.right = background.bottom = <span style="color: #cc66cc;">1</span>;</span>
<span style="color: #000000;">                    textDisplay.left = textDisplay.top = textDisplay.right = textDisplay.bottom = <span style="color: #cc66cc;">1</span>;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span> else <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    border.visible = false;</span>
<span style="color: #000000;">                    shadow.visible = false;</span>
<span style="color: #000000;">                    background.left = background.top = background.right = background.bottom = <span style="color: #cc66cc;">0</span>;</span>
<span style="color: #000000;">                    textDisplay.left = textDisplay.top = textDisplay.right = textDisplay.bottom = <span style="color: #cc66cc;">0</span>;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">                borderStroke.color = getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;borderColor&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                borderStroke.alpha = getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;borderAlpha&quot;</span><span style="color: #66cc66;">&#41;</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>
&nbsp;
<span style="color: #000000;">            private function updatePadding<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                if <span style="color: #66cc66;">&#40;</span>!textDisplay<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    return;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">                // Push padding styles into the textDisplay</span>
<span style="color: #000000;">                var padding:Number;</span>
&nbsp;
<span style="color: #000000;">                padding = getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;paddingLeft&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                if <span style="color: #66cc66;">&#40;</span>textDisplay.getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;paddingLeft&quot;</span><span style="color: #66cc66;">&#41;</span> != padding<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    textDisplay.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;paddingLeft&quot;</span>, padding<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">                padding = getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;paddingTop&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                if <span style="color: #66cc66;">&#40;</span>textDisplay.getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;paddingTop&quot;</span><span style="color: #66cc66;">&#41;</span> != padding<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    textDisplay.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;paddingTop&quot;</span>, padding<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">                padding = getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;paddingRight&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                if <span style="color: #66cc66;">&#40;</span>textDisplay.getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;paddingRight&quot;</span><span style="color: #66cc66;">&#41;</span> != padding<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    textDisplay.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;paddingRight&quot;</span>, padding<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">                padding = getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;paddingBottom&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                if <span style="color: #66cc66;">&#40;</span>textDisplay.getStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;paddingBottom&quot;</span><span style="color: #66cc66;">&#41;</span> != padding<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    textDisplay.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;paddingBottom&quot;</span>, padding<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;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            override public function styleChanged<span style="color: #66cc66;">&#40;</span>styleProp:String<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                super.styleChanged<span style="color: #66cc66;">&#40;</span>styleProp<span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                if <span style="color: #66cc66;">&#40;</span>!styleProp || styleProp.indexOf<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;padding&quot;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    paddingChanged = true;</span>
<span style="color: #000000;">                    invalidateProperties<span style="color: #66cc66;">&#40;</span><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;">&#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: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;">            override public function get focusSkinExclusions<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:Array <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                return <span style="color: #66cc66;">&#91;</span> textDisplay <span style="color: #66cc66;">&#93;</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;!-- border --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> id=<span style="color: #ff0000;">&quot;border&quot;</span></span>
<span style="color: #000000;">            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:stroke</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColorStroke</span> id=<span style="color: #ff0000;">&quot;borderStroke&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: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;!-- fill --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!--- Defines the appearance of the TextArea component's 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></span>
<span style="color: #000000;">            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;1&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;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;purple&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;!-- shadow --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> id=<span style="color: #ff0000;">&quot;shadow&quot;</span></span>
<span style="color: #000000;">            left=<span style="color: #ff0000;">&quot;1&quot;</span> top=<span style="color: #ff0000;">&quot;1&quot;</span> right=<span style="color: #ff0000;">&quot;1&quot;</span> height=<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: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> alpha=<span style="color: #ff0000;">&quot;0.12&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;!--- Defines the scroller used to scroll the RichEditableText. --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Scroller</span> id=<span style="color: #ff0000;">&quot;scroller&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>
<span style="color: #000000;">            minViewportInset=<span style="color: #ff0000;">&quot;1&quot;</span></span>
<span style="color: #000000;">            measuredSizeIncludesScrollBars=<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:RichEditableText</span> id=<span style="color: #ff0000;">&quot;textDisplay&quot;</span></span>
<span style="color: #000000;">                widthInChars=<span style="color: #ff0000;">&quot;15&quot;</span> heightInLines=<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:Scroller</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:SparkSkin</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>You can also set the <code>skinClass</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/2009/10/24/setting-a-gradient-background-fill-on-a-spark-textarea-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_TextArea_skin_background_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        @namespace s &quot;library://ns.adobe.com/flex/spark&quot;;
        @namespace mx &quot;library://ns.adobe.com/flex/halo&quot;;
&nbsp;
        s|TextArea {
            skinClass: ClassReference(&quot;skins.CustomTextAreaSkin&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:TextArea</span> id=<span style="color: #ff0000;">&quot;ta&quot;</span></span>
<span style="color: #000000;">            text=<span style="color: #ff0000;">&quot;{Capabilities.serverString}&quot;</span></span>
<span style="color: #000000;">            verticalScrollPolicy=<span style="color: #ff0000;">&quot;on&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>Or, you can set the <code>skinClass</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/2009/10/24/setting-a-gradient-background-fill-on-a-spark-textarea-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_TextArea_skin_background_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;btn&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Set TextArea background gradient&quot;</span></span>
<span style="color: #000000;">                click=<span style="color: #ff0000;">&quot;btn_click(event);&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 skins.CustomTextAreaSkin;</span>
&nbsp;
<span style="color: #000000;">            protected function btn_click<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                ta.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;skinClass&quot;</span>, CustomTextAreaSkin<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:TextArea</span> id=<span style="color: #ff0000;">&quot;ta&quot;</span></span>
<span style="color: #000000;">            text=<span style="color: #ff0000;">&quot;{Capabilities.serverString}&quot;</span></span>
<span style="color: #000000;">            verticalScrollPolicy=<span style="color: #ff0000;">&quot;on&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 class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting a gradient background fill on a Spark TextArea control in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/10/24/setting-a-gradient-background-fill-on-a-spark-textarea-control-in-flex-4/',contentID: 'post-2079',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'background,entries,fill,GradientEntry,Gumbo,lineargradient,rotation,skin,skinClass,TextAreaSkin',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/10/24/setting-a-gradient-background-fill-on-a-spark-textarea-control-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Setting the origin X and Y coordinate for a linear gradient stroke in Flex Gumbo</title>
		<link>http://blog.flexexamples.com/2009/01/04/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-stroke-in-flex-gumbo/</link>
		<comments>http://blog.flexexamples.com/2009/01/04/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-stroke-in-flex-gumbo/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 07:42:11 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta]]></category>
		<category><![CDATA[FXG]]></category>
		<category><![CDATA[GradientEntry]]></category>
		<category><![CDATA[LinearGradientStroke]]></category>
		<category><![CDATA[Rect]]></category>
		<category><![CDATA[entries]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[rotation]]></category>
		<category><![CDATA[stroke]]></category>
		<category><![CDATA[x]]></category>
		<category><![CDATA[y]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2009/01/04/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-stroke-in-flex-gumbo/</guid>
		<description><![CDATA[<p>The following example shows how you can set the origin X and Y coordinate for a linear gradient stroke in Flex Gumbo by setting the x and y properties on the LinearGradientStroke object.</p> <p>Full code after the jump.</p> <p></p> <p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the origin X and Y coordinate for a linear gradient stroke in Flex Gumbo by setting the <code>x</code> and <code>y</code> properties on the LinearGradientStroke object.</p>
<p>Full code after the jump.</p>
<p><span id="more-923"></span></p>
<p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see <a href="http://blog.flexexamples.com/2008/08/02/using-the-beta-gumbo-sdk-in-flex-builder-3/">&#8220;Using the beta Gumbo SDK in Flex Builder 3&#8243;</a>.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradientStroke_x_test/bin/srcview/source/main_4407.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/01/04/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-stroke-in-flex-gumbo/ --&gt;
&lt;Application name="LinearGradientStroke_x_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;ApplicationControlBar dock="true"&gt;
        &lt;Form styleName="plain"&gt;
            &lt;FormItem label="x:"&gt;
                &lt;HSlider id="xSlider"
                        minimum="-100"
                        maximum="100"
                        value="0"
                        snapInterval="1"
                        tickInterval="25"
                        liveDragging="true" /&gt;
            &lt;/FormItem&gt;
            &lt;FormItem label="y:"&gt;
                &lt;HSlider id="ySlider"
                        minimum="-100"
                        maximum="100"
                        value="0"
                        snapInterval="1"
                        tickInterval="25"
                        liveDragging="true" /&gt;
            &lt;/FormItem&gt;
            &lt;FormItem label="rotation:"&gt;
                &lt;HSlider id="rotationSlider"
                        minimum="-360"
                        maximum="360"
                        value="0"
                        snapInterval="1"
                        tickInterval="45"
                        liveDragging="true" /&gt;
            &lt;/FormItem&gt;
        &lt;/Form&gt;
    &lt;/ApplicationControlBar&gt;

    &lt;Graphic&gt;
        &lt;Rect id="rect" width="300" height="200"&gt;
            &lt;stroke&gt;
                &lt;LinearGradientStroke id="linearGrad"
                        x="{xSlider.value}"
                        y="{ySlider.value}"
                        rotation="{rotationSlider.value}"
                        weight="5"&gt;
                    &lt;GradientEntry color="red" /&gt;
                    &lt;GradientEntry color="white" /&gt;
                    &lt;GradientEntry color="blue" /&gt;
                &lt;/LinearGradientStroke&gt;
            &lt;/stroke&gt;
        &lt;/Rect&gt;
    &lt;/Graphic&gt;

&lt;/Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradientStroke_x_test/bin/srcview/">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/LinearGradientStroke_x_test/bin/main_4407.html" width="100%" height="350"></iframe></p>
<p>You can also set the LinearGradientStroke object&#8217;s <code>x</code>, <code>y</code>, and <code>rotation</code> properties using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradientStroke_x_test/bin/srcview/source/main2_4407.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/01/04/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-stroke-in-flex-gumbo/ --&gt;
&lt;Application name="LinearGradientStroke_x_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;Script&gt;
        &lt;![CDATA[
            import mx.events.SliderEvent;

            private function xSlider_change(evt:SliderEvent):void {
                linearGrad.x = evt.value;
            }

            private function ySlider_change(evt:SliderEvent):void {
                linearGrad.y = evt.value;
            }

            private function rotationSlider_change(evt:SliderEvent):void {
                linearGrad.rotation = evt.value;
            }
        ]]&gt;
    &lt;/Script&gt;

    &lt;ApplicationControlBar dock="true"&gt;
        &lt;Form styleName="plain"&gt;
            &lt;FormItem label="x:"&gt;
                &lt;HSlider id="xSlider"
                        minimum="-100"
                        maximum="100"
                        value="0"
                        snapInterval="1"
                        tickInterval="25"
                        liveDragging="true"
                        change="xSlider_change(event);" /&gt;
            &lt;/FormItem&gt;
            &lt;FormItem label="y:"&gt;
                &lt;HSlider id="ySlider"
                        minimum="-100"
                        maximum="100"
                        value="0"
                        snapInterval="1"
                        tickInterval="25"
                        liveDragging="true"
                        change="ySlider_change(event);" /&gt;
            &lt;/FormItem&gt;
            &lt;FormItem label="rotation:"&gt;
                &lt;HSlider id="rotationSlider"
                        minimum="-360"
                        maximum="360"
                        value="0"
                        snapInterval="1"
                        tickInterval="45"
                        liveDragging="true"
                        change="rotationSlider_change(event);" /&gt;
            &lt;/FormItem&gt;
        &lt;/Form&gt;
    &lt;/ApplicationControlBar&gt;

    &lt;Graphic&gt;
        &lt;Rect id="rect" width="300" height="200"&gt;
            &lt;stroke&gt;
                &lt;LinearGradientStroke id="linearGrad"
                        x="{xSlider.value}"
                        y="{ySlider.value}"
                        rotation="{rotationSlider.value}"
                        weight="5"&gt;
                    &lt;GradientEntry color="red" /&gt;
                    &lt;GradientEntry color="white" /&gt;
                    &lt;GradientEntry color="blue" /&gt;
                &lt;/LinearGradientStroke&gt;
            &lt;/stroke&gt;
        &lt;/Rect&gt;
    &lt;/Graphic&gt;

&lt;/Application&gt;
</pre>
<p class="alert">This entry is based on a beta version of the Flex Gumbo SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex Gumbo SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the origin X and Y coordinate for a linear gradient stroke in Flex Gumbo on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/01/04/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-stroke-in-flex-gumbo/',contentID: 'post-923',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'entries,Gumbo,rotation,stroke,x,y',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/01/04/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-stroke-in-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting the rotation of a linear gradient stroke in Flex Gumbo</title>
		<link>http://blog.flexexamples.com/2009/01/03/setting-the-rotation-of-a-linear-gradient-stroke-in-flex-gumbo/</link>
		<comments>http://blog.flexexamples.com/2009/01/03/setting-the-rotation-of-a-linear-gradient-stroke-in-flex-gumbo/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 07:59:45 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta]]></category>
		<category><![CDATA[FXG]]></category>
		<category><![CDATA[GradientEntry]]></category>
		<category><![CDATA[LinearGradientStroke]]></category>
		<category><![CDATA[Rect]]></category>
		<category><![CDATA[entries]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[rotation]]></category>
		<category><![CDATA[stroke]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2009/01/03/setting-the-rotation-of-a-linear-gradient-stroke-in-flex-gumbo/</guid>
		<description><![CDATA[<p>The following example shows how you can set the angle of a LinearGradientStroke stroke on a Flex Gumbo Ellipse object by setting the rotation property on the LinearGradientStroke object.</p> <p>Full code after the jump.</p> <p></p> <p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the angle of a LinearGradientStroke stroke on a Flex Gumbo Ellipse object by setting the <code>rotation</code> property on the LinearGradientStroke object.</p>
<p>Full code after the jump.</p>
<p><span id="more-922"></span></p>
<p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see <a href="http://blog.flexexamples.com/2008/08/02/using-the-beta-gumbo-sdk-in-flex-builder-3/">&#8220;Using the beta Gumbo SDK in Flex Builder 3&#8243;</a>.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradientStroke_rotation_test/bin/srcview/source/main_4407.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/01/03/setting-the-rotation-of-a-linear-gradient-stroke-in-flex-gumbo/ --&gt;
&lt;Application name="LinearGradientStroke_rotation_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;ApplicationControlBar dock="true"&gt;
        &lt;Form styleName="plain"&gt;
            &lt;FormItem label="rotation:"&gt;
                &lt;HSlider id="slider"
                        minimum="-360"
                        maximum="360"
                        value="0"
                        snapInterval="1"
                        tickInterval="45"
                        liveDragging="true" /&gt;
            &lt;/FormItem&gt;
        &lt;/Form&gt;
    &lt;/ApplicationControlBar&gt;

    &lt;Graphic&gt;
        &lt;Rect id="rect" width="300" height="200"&gt;
            &lt;stroke&gt;
                &lt;LinearGradientStroke id="linearGrad"
                        rotation="{slider.value}"
                        weight="10"&gt;
                    &lt;entries&gt;
                        &lt;GradientEntry color="red" /&gt;
                        &lt;GradientEntry color="white" /&gt;
                        &lt;GradientEntry color="blue" /&gt;
                    &lt;/entries&gt;
                &lt;/LinearGradientStroke&gt;
            &lt;/stroke&gt;
        &lt;/Rect&gt;
    &lt;/Graphic&gt;

&lt;/Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradientStroke_rotation_test/bin/srcview/">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/LinearGradientStroke_rotation_test/bin/main_4407.html" width="100%" height="300"></iframe></p>
<p>You can also set the <code>rotation</code> property using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradientStroke_rotation_test/bin/srcview/source/main2_4407.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/01/03/setting-the-rotation-of-a-linear-gradient-stroke-in-flex-gumbo/ --&gt;
&lt;Application name="LinearGradientStroke_rotation_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;Script&gt;
        &lt;![CDATA[
            import mx.events.SliderEvent;

            private function slider_change(evt:SliderEvent):void {
                linearGrad.rotation = evt.value;
            }
        ]]&gt;
    &lt;/Script&gt;

    &lt;ApplicationControlBar dock="true"&gt;
        &lt;Form styleName="plain"&gt;
            &lt;FormItem label="rotation:"&gt;
                &lt;HSlider id="slider"
                        minimum="-360"
                        maximum="360"
                        value="0"
                        snapInterval="1"
                        tickInterval="45"
                        liveDragging="true"
                        change="slider_change(event);" /&gt;
            &lt;/FormItem&gt;
        &lt;/Form&gt;
    &lt;/ApplicationControlBar&gt;

    &lt;Graphic&gt;
        &lt;Rect id="rect" width="300" height="200"&gt;
            &lt;stroke&gt;
                &lt;LinearGradientStroke id="linearGrad"
                        weight="10"&gt;
                    &lt;entries&gt;
                        &lt;GradientEntry color="red" /&gt;
                        &lt;GradientEntry color="white" /&gt;
                        &lt;GradientEntry color="blue" /&gt;
                    &lt;/entries&gt;
                &lt;/LinearGradientStroke&gt;
            &lt;/stroke&gt;
        &lt;/Rect&gt;
    &lt;/Graphic&gt;

&lt;/Application&gt;
</pre>
<p class="alert">This entry is based on a beta version of the Flex Gumbo SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex Gumbo SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the rotation of a linear gradient stroke in Flex Gumbo on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/01/03/setting-the-rotation-of-a-linear-gradient-stroke-in-flex-gumbo/',contentID: 'post-922',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'entries,Gumbo,rotation,stroke',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/01/03/setting-the-rotation-of-a-linear-gradient-stroke-in-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smoothing images using the BitmapGraphic object in Flex Gumbo</title>
		<link>http://blog.flexexamples.com/2008/12/20/smoothing-images-using-the-bitmapgraphic-object-in-flex-gumbo/</link>
		<comments>http://blog.flexexamples.com/2008/12/20/smoothing-images-using-the-bitmapgraphic-object-in-flex-gumbo/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 07:32:44 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta]]></category>
		<category><![CDATA[BitmapGraphic]]></category>
		<category><![CDATA[FXG]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[rotation]]></category>
		<category><![CDATA[smooth]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/12/20/smoothing-images-using-the-bitmapgraphic-object-in-flex-gumbo/</guid>
		<description><![CDATA[<p>The following example shows how you can smooth a Flex Gumbo BitmapGraphic object by setting the Boolean smooth property.</p> <p>Full code after the jump.</p> <p></p> <p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can smooth a Flex Gumbo BitmapGraphic object by setting the Boolean <code>smooth</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-905"></span></p>
<p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see <a href="http://blog.flexexamples.com/2008/08/02/using-the-beta-gumbo-sdk-in-flex-builder-3/">&#8220;Using the beta Gumbo SDK in Flex Builder 3&#8243;</a>.</p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/12/20/smoothing-images-using-the-bitmapgraphic-object-in-flex-gumbo/ --&gt;
&lt;Application name="BitmapGraphic_smooth_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;ApplicationControlBar dock="true"&gt;
        &lt;Form styleName="plain"&gt;
            &lt;FormItem label="smooth:"&gt;
                &lt;CheckBox id="checkBox" /&gt;
            &lt;/FormItem&gt;
            &lt;FormItem label="rotation:"&gt;
                &lt;HSlider id="slider"
                        minimum="0"
                        maximum="360"
                        snapInterval="1"
                        tickInterval="15"
                        liveDragging="true" /&gt;
            &lt;/FormItem&gt;
        &lt;/Form&gt;
    &lt;/ApplicationControlBar&gt;

    &lt;Graphic&gt;
        &lt;BitmapGraphic id="bitmapGraphic"
                source="@Embed('assets/fx_appicon-tn.gif')"
                rotation="{slider.value}"
                smooth="{checkBox.selected}" /&gt;
    &lt;/Graphic&gt;

&lt;/Application&gt;
</pre>
<p class="alert">This entry is based on a beta version of the Flex Gumbo SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex Gumbo SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Smoothing images using the BitmapGraphic object in Flex Gumbo on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/12/20/smoothing-images-using-the-bitmapgraphic-object-in-flex-gumbo/',contentID: 'post-905',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'Gumbo,rotation,smooth',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/2008/12/20/smoothing-images-using-the-bitmapgraphic-object-in-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting the origin X and Y coordinate for a linear gradient fill in Flex Gumbo</title>
		<link>http://blog.flexexamples.com/2008/11/30/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-fill-in-flex-gumbo/</link>
		<comments>http://blog.flexexamples.com/2008/11/30/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-fill-in-flex-gumbo/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 07:50:35 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta]]></category>
		<category><![CDATA[FXG]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[lineargradient]]></category>
		<category><![CDATA[rotation]]></category>
		<category><![CDATA[x]]></category>
		<category><![CDATA[y]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/11/30/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-fill-in-flex-gumbo/</guid>
		<description><![CDATA[<p>The following example shows how you can set the origin X and Y coordinate for a linear gradient fill in Flex Gumbo by setting the x and y properties on the LinearGradient object.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradient_x_test/bin/srcview/source/main_4235.mxml.html">View MXML</a></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2008/11/30/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-fill-in-flex-gumbo/ --&#62; &#60;Application name=&#34;LinearGradient_x_test&#34; xmlns=&#34;http://ns.adobe.com/mxml/2009&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34;&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the origin X and Y coordinate for a linear gradient fill in Flex Gumbo by setting the <code>x</code> and <code>y</code> properties on the LinearGradient object.</p>
<p>Full code after the jump.</p>
<p><span id="more-883"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradient_x_test/bin/srcview/source/main_4235.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2008/11/30/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-fill-in-flex-gumbo/ --&gt;
&lt;Application name=&quot;LinearGradient_x_test&quot;
        xmlns=&quot;http://ns.adobe.com/mxml/2009&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;&gt;

    &lt;ApplicationControlBar dock=&quot;true&quot;&gt;
        &lt;Form styleName=&quot;plain&quot;&gt;
            &lt;FormItem label=&quot;x:&quot;&gt;
                &lt;HSlider id=&quot;xSlider&quot;
                        minimum=&quot;-100&quot;
                        maximum=&quot;100&quot;
                        value=&quot;0&quot;
                        snapInterval=&quot;1&quot;
                        tickInterval=&quot;25&quot;
                        liveDragging=&quot;true&quot; /&gt;
            &lt;/FormItem&gt;
            &lt;FormItem label=&quot;y:&quot;&gt;
                &lt;HSlider id=&quot;ySlider&quot;
                        minimum=&quot;-100&quot;
                        maximum=&quot;100&quot;
                        value=&quot;0&quot;
                        snapInterval=&quot;1&quot;
                        tickInterval=&quot;25&quot;
                        liveDragging=&quot;true&quot; /&gt;
            &lt;/FormItem&gt;
            &lt;FormItem label=&quot;rotation:&quot;&gt;
                &lt;HSlider id=&quot;rotationSlider&quot;
                        minimum=&quot;-360&quot;
                        maximum=&quot;360&quot;
                        value=&quot;0&quot;
                        snapInterval=&quot;1&quot;
                        tickInterval=&quot;45&quot;
                        liveDragging=&quot;true&quot; /&gt;
            &lt;/FormItem&gt;
        &lt;/Form&gt;
    &lt;/ApplicationControlBar&gt;

    &lt;Graphic&gt;
        &lt;Ellipse id=&quot;ellipse&quot; width=&quot;300&quot; height=&quot;200&quot;&gt;
            &lt;fill&gt;
                &lt;LinearGradient id=&quot;linearGrad&quot;
                        x=&quot;{xSlider.value}&quot;
                        y=&quot;{ySlider.value}&quot;
                        rotation=&quot;{rotationSlider.value}&quot;&gt;
                    &lt;GradientEntry color=&quot;red&quot; /&gt;
                    &lt;GradientEntry color=&quot;white&quot; /&gt;
                    &lt;GradientEntry color=&quot;blue&quot; /&gt;
                &lt;/LinearGradient&gt;
            &lt;/fill&gt;
        &lt;/Ellipse&gt;
    &lt;/Graphic&gt;

&lt;/Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradient_x_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/LinearGradient_x_test/bin/main_4235.html" width="100%" height="350"></iframe></p>
<p class="alert">This entry is based on a beta version of the Flex Gumbo SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex Gumbo SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the origin X and Y coordinate for a linear gradient fill in Flex Gumbo on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/11/30/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-fill-in-flex-gumbo/',contentID: 'post-883',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'Gumbo,lineargradient,rotation,x,y',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/2008/11/30/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-fill-in-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting the rotation of a linear gradient in Flex Gumbo</title>
		<link>http://blog.flexexamples.com/2008/11/29/setting-the-rotation-of-a-linear-gradient-in-flex-gumbo/</link>
		<comments>http://blog.flexexamples.com/2008/11/29/setting-the-rotation-of-a-linear-gradient-in-flex-gumbo/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 05:26:25 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta]]></category>
		<category><![CDATA[FXG]]></category>
		<category><![CDATA[GradientEntry]]></category>
		<category><![CDATA[entries]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[lineargradient]]></category>
		<category><![CDATA[rotation]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/11/29/setting-the-rotation-of-a-linear-gradient-in-flex-gumbo/</guid>
		<description><![CDATA[<p>The following example shows how you can set the angle of a LinearGradient fill on a Flex Gumbo Ellipse object by setting the rotation property.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradient_rotation_test/bin/srcview/source/main_4178.mxml.html">View MXML</a></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2008/11/29/setting-the-rotation-of-a-linear-gradient-in-flex-gumbo/ --&#62; &#60;Application name=&#34;LinearGradient_rotation_test&#34; xmlns=&#34;http://ns.adobe.com/mxml/2009&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34;&#62; &#60;ApplicationControlBar dock=&#34;true&#34;&#62; &#60;Form styleName=&#34;plain&#34;&#62; &#60;FormItem label=&#34;rotation:&#34;&#62; &#60;HSlider id=&#34;slider&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the angle of a LinearGradient fill on a Flex Gumbo Ellipse object by setting the <code>rotation</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-882"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradient_rotation_test/bin/srcview/source/main_4178.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2008/11/29/setting-the-rotation-of-a-linear-gradient-in-flex-gumbo/ --&gt;
&lt;Application name=&quot;LinearGradient_rotation_test&quot;
        xmlns=&quot;http://ns.adobe.com/mxml/2009&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;&gt;

    &lt;ApplicationControlBar dock=&quot;true&quot;&gt;
        &lt;Form styleName=&quot;plain&quot;&gt;
            &lt;FormItem label=&quot;rotation:&quot;&gt;
                &lt;HSlider id=&quot;slider&quot;
                        minimum=&quot;-360&quot;
                        maximum=&quot;360&quot;
                        value=&quot;0&quot;
                        snapInterval=&quot;1&quot;
                        tickInterval=&quot;45&quot;
                        liveDragging=&quot;true&quot; /&gt;

            &lt;/FormItem&gt;
        &lt;/Form&gt;
    &lt;/ApplicationControlBar&gt;

    &lt;Graphic&gt;
        &lt;Ellipse id=&quot;ellipse&quot; width=&quot;300&quot; height=&quot;200&quot;&gt;
            &lt;fill&gt;
                &lt;LinearGradient id=&quot;linearGrad&quot;
                        rotation=&quot;{slider.value}&quot;&gt;
                    &lt;GradientEntry color=&quot;red&quot; /&gt;
                    &lt;GradientEntry color=&quot;white&quot; /&gt;
                    &lt;GradientEntry color=&quot;blue&quot; /&gt;
                &lt;/LinearGradient&gt;
            &lt;/fill&gt;
        &lt;/Ellipse&gt;
    &lt;/Graphic&gt;

&lt;/Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradient_rotation_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/LinearGradient_rotation_test/bin/main_4178.html" width="100%" height="350"></iframe></p>
<p>You could also set the <code>rotation</code> property using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradient_rotation_test/bin/srcview/source/main2_4178.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2008/11/29/setting-the-rotation-of-a-linear-gradient-in-flex-gumbo/ --&gt;
&lt;Application name=&quot;LinearGradient_rotation_test&quot;
        xmlns=&quot;http://ns.adobe.com/mxml/2009&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;&gt;

    &lt;Script&gt;
        &lt;![CDATA[
            import mx.events.SliderEvent;

            private function slider_change(evt:SliderEvent):void {
                linearGrad.rotation = evt.value;
            }
        ]]&gt;
    &lt;/Script&gt;

    &lt;ApplicationControlBar dock=&quot;true&quot;&gt;
        &lt;Form styleName=&quot;plain&quot;&gt;
            &lt;FormItem label=&quot;rotation:&quot;&gt;
                &lt;HSlider id=&quot;slider&quot;
                        minimum=&quot;-360&quot;
                        maximum=&quot;360&quot;
                        value=&quot;0&quot;
                        snapInterval=&quot;1&quot;
                        tickInterval=&quot;45&quot;
                        liveDragging=&quot;true&quot;
                        change=&quot;slider_change(event);&quot; /&gt;

            &lt;/FormItem&gt;
        &lt;/Form&gt;
    &lt;/ApplicationControlBar&gt;

    &lt;Graphic&gt;
        &lt;Ellipse id=&quot;ellipse&quot; width=&quot;300&quot; height=&quot;200&quot;&gt;
            &lt;fill&gt;
                &lt;LinearGradient id=&quot;linearGrad&quot;&gt;
                    &lt;GradientEntry color=&quot;red&quot; /&gt;
                    &lt;GradientEntry color=&quot;white&quot; /&gt;
                    &lt;GradientEntry color=&quot;blue&quot; /&gt;
                &lt;/LinearGradient&gt;
            &lt;/fill&gt;
        &lt;/Ellipse&gt;
    &lt;/Graphic&gt;

&lt;/Application&gt;
</pre>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradient_rotation_test/bin/srcview/source/main3_4178.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2008/11/29/setting-the-rotation-of-a-linear-gradient-in-flex-gumbo/ --&gt;
&lt;Application name=&quot;LinearGradient_rotation_test&quot;
        xmlns=&quot;http://ns.adobe.com/mxml/2009&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;
        initialize=&quot;init();&quot;&gt;

    &lt;Script&gt;
        &lt;![CDATA[
            import mx.containers.ApplicationControlBar;
            import mx.containers.Form;
            import mx.containers.FormItem;
            import mx.controls.HSlider;
            import mx.events.SliderEvent;
            import mx.graphics.Ellipse;
            import mx.graphics.GradientEntry;
            import mx.graphics.Graphic;
            import mx.graphics.LinearGradient

            private var ellipse:Ellipse;
            private var linearGrad:LinearGradient;
            private var slider:HSlider;

            private function init():void {
                slider = new HSlider();
                slider.minimum = -360;
                slider.maximum = 360;
                slider.value = 0;
                slider.snapInterval = 1;
                slider.tickInterval = 45;
                slider.liveDragging = true;
                slider.addEventListener(SliderEvent.CHANGE, slider_change);

                var formItem:FormItem = new FormItem();
                formItem.label = &quot;rotation:&quot;;
                formItem.addChild(slider);

                var form:Form = new Form();
                form.styleName = &quot;plain&quot;;
                form.addChild(formItem);

                var appControlBar:ApplicationControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.addChild(form);
                addChildAt(appControlBar, 0);

                var entryArr:Array = [];
                entryArr.push(new GradientEntry(0xFF0000)); // red
                entryArr.push(new GradientEntry(0xFFFFFF)); // white
                entryArr.push(new GradientEntry(0x0000FF)); // blue

                linearGrad = new LinearGradient();
                linearGrad.entries = entryArr;

                ellipse = new Ellipse();
                ellipse.fill = linearGrad;
                ellipse.width = 300;
                ellipse.height = 200;

                var graphic:Graphic = new Graphic();
                graphic.addItem(ellipse);
                addChild(graphic);
            }

            private function slider_change(evt:SliderEvent):void {
                linearGrad.rotation = evt.value;
                // or
                // LinearGradient(ellipse.fill).rotation = evt.value;
            }
        ]]&gt;
    &lt;/Script&gt;

&lt;/Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the rotation of a linear gradient in Flex Gumbo on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/11/29/setting-the-rotation-of-a-linear-gradient-in-flex-gumbo/',contentID: 'post-882',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'entries,Gumbo,lineargradient,rotation',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/2008/11/29/setting-the-rotation-of-a-linear-gradient-in-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

