<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Rounding the corners of an Image control in Flex using a mask</title>
	<atom:link href="http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Fri, 19 Mar 2010 09:24:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Tahir Alvi</title>
		<link>http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/comment-page-1/#comment-6481</link>
		<dc:creator>Tahir Alvi</dc:creator>
		<pubDate>Fri, 27 Nov 2009 10:43:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/#comment-6481</guid>
		<description>Please help me.

i want to erase the drawing after some drawing,  drawing maybe line rectangle dot or anything.

Thnaks</description>
		<content:encoded><![CDATA[<p>Please help me.</p>
<p>i want to erase the drawing after some drawing,  drawing maybe line rectangle dot or anything.</p>
<p>Thnaks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon B</title>
		<link>http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/comment-page-1/#comment-6288</link>
		<dc:creator>Brandon B</dc:creator>
		<pubDate>Sat, 07 Nov 2009 10:15:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/#comment-6288</guid>
		<description>How Would You get something like this to work on an Image,in The Array Collection,or The Repeater?
I tried,all types of different methods,and nothing seems to just work.
any advice would certainly be excellent.,</description>
		<content:encoded><![CDATA[<p>How Would You get something like this to work on an Image,in The Array Collection,or The Repeater?<br />
I tried,all types of different methods,and nothing seems to just work.<br />
any advice would certainly be excellent.,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Usman Ajmal</title>
		<link>http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/comment-page-1/#comment-6135</link>
		<dc:creator>Usman Ajmal</dc:creator>
		<pubDate>Tue, 27 Oct 2009 06:59:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/#comment-6135</guid>
		<description>&lt;blockquote&gt;Can this portion of the tag be used to create a FLEX based lightbox similar to java lightboxes that I have seen?&lt;/blockquote&gt;

Did you manage to find a way of creating a Flex based lightbox? I need the lightbox functionality in one of my Flex application.</description>
		<content:encoded><![CDATA[<blockquote><p>Can this portion of the tag be used to create a FLEX based lightbox similar to java lightboxes that I have seen?</p></blockquote>
<p>Did you manage to find a way of creating a Flex based lightbox? I need the lightbox functionality in one of my Flex application.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: guy</title>
		<link>http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/comment-page-1/#comment-6077</link>
		<dc:creator>guy</dc:creator>
		<pubDate>Wed, 21 Oct 2009 07:07:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/#comment-6077</guid>
		<description>Thanks Peter, that did the job</description>
		<content:encoded><![CDATA[<p>Thanks Peter, that did the job</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/comment-page-1/#comment-6075</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Tue, 20 Oct 2009 23:20:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/#comment-6075</guid>
		<description>@guy,

Not sure the best way to add strokes/borders to an irregularly shaped object, but you can just use a GlowFilter, as shown in the following example:
&lt;pre lang=&quot;mxml&quot;&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/ --&gt;
&lt;mx:Application name=&quot;Image_mask_test&quot;
        xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;
        initialize=&quot;init();&quot;&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.ResizeEvent;

            private var roundedMask:Sprite;

            private function init():void {
                roundedMask = new Sprite();
                canvas.rawChildren.addChild(roundedMask);
            }

            private function image_resize(evt:ResizeEvent):void {
                var w:Number = evt.currentTarget.width;
                var h:Number = evt.currentTarget.height;
                var cornerRadius:uint = 60;

                roundedMask.graphics.clear();
                roundedMask.graphics.beginFill(0xFF0000);
                roundedMask.graphics.drawRoundRectComplex(0, 0,
                    w, h,
                    0, cornerRadius,
                    0, cornerRadius);
                roundedMask.graphics.endFill();
                image.mask = roundedMask;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Canvas id=&quot;canvas&quot;&gt;
        &lt;mx:filters&gt;
            &lt;mx:GlowFilter blurX=&quot;5&quot; blurY=&quot;5&quot; strength=&quot;6&quot; color=&quot;#FF0000&quot; inner=&quot;false&quot; /&gt;
        &lt;/mx:filters&gt;
        &lt;mx:Image id=&quot;image&quot;
                  source=&quot;http://www.helpexamples.com/flash/images/image1.jpg&quot;
                  resize=&quot;image_resize(event);&quot; /&gt;
    &lt;/mx:Canvas&gt;

&lt;/mx:Application&gt;
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p>@guy,</p>
<p>Not sure the best way to add strokes/borders to an irregularly shaped object, but you can just use a GlowFilter, as shown 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/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;Image_mask_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>
<span style="color: #000000;">        initialize=<span style="color: #ff0000;">&quot;init();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.events.ResizeEvent;</span>
&nbsp;
<span style="color: #339933;">            private var roundedMask:Sprite;</span>
&nbsp;
<span style="color: #339933;">            private function init():void {</span>
<span style="color: #339933;">                roundedMask = new Sprite();</span>
<span style="color: #339933;">                canvas.rawChildren.addChild(roundedMask);</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            private function image_resize(evt:ResizeEvent):void {</span>
<span style="color: #339933;">                var w:Number = evt.currentTarget.width;</span>
<span style="color: #339933;">                var h:Number = evt.currentTarget.height;</span>
<span style="color: #339933;">                var cornerRadius:uint = 60;</span>
&nbsp;
<span style="color: #339933;">                roundedMask.graphics.clear();</span>
<span style="color: #339933;">                roundedMask.graphics.beginFill(0xFF0000);</span>
<span style="color: #339933;">                roundedMask.graphics.drawRoundRectComplex(0, 0,</span>
<span style="color: #339933;">                    w, h,</span>
<span style="color: #339933;">                    0, cornerRadius,</span>
<span style="color: #339933;">                    0, cornerRadius);</span>
<span style="color: #339933;">                roundedMask.graphics.endFill();</span>
<span style="color: #339933;">                image.mask = roundedMask;</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> id=<span style="color: #ff0000;">&quot;canvas&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:filters</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:GlowFilter</span> blurX=<span style="color: #ff0000;">&quot;5&quot;</span> blurY=<span style="color: #ff0000;">&quot;5&quot;</span> strength=<span style="color: #ff0000;">&quot;6&quot;</span> color=<span style="color: #ff0000;">&quot;#FF0000&quot;</span> inner=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:filters</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Image</span> id=<span style="color: #ff0000;">&quot;image&quot;</span></span>
<span style="color: #000000;">                  source=<span style="color: #ff0000;">&quot;http://www.helpexamples.com/flash/images/image1.jpg&quot;</span></span>
<span style="color: #000000;">                  resize=<span style="color: #ff0000;">&quot;image_resize(event);&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>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: guy</title>
		<link>http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/comment-page-1/#comment-6073</link>
		<dc:creator>guy</dc:creator>
		<pubDate>Tue, 20 Oct 2009 21:12:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/#comment-6073</guid>
		<description>Thanks Peter, that worked great.

Sorry to nag but do you know maybe how I can also add a pixel border to the outcome? I managed that before rounding the corners with a box behind it but that won&#039;t do the work now.

Thanks in advance,
Guy</description>
		<content:encoded><![CDATA[<p>Thanks Peter, that worked great.</p>
<p>Sorry to nag but do you know maybe how I can also add a pixel border to the outcome? I managed that before rounding the corners with a box behind it but that won&#8217;t do the work now.</p>
<p>Thanks in advance,<br />
Guy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/comment-page-1/#comment-6068</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Tue, 20 Oct 2009 14:17:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/#comment-6068</guid>
		<description>@guy,

Instead of using the &lt;code&gt;drawRoundRect()&lt;/code&gt; method, use the &lt;code&gt;drawRoundRectComplex()&lt;/code&gt; method which allows you to specify the radius of each corner separately:
&lt;pre lang=&quot;mxml&quot;&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/ --&gt;
&lt;mx:Application name=&quot;Image_mask_test&quot;
        xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;
        initialize=&quot;init();&quot;&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.ResizeEvent;

            private var roundedMask:Sprite;

            private function init():void {
                roundedMask = new Sprite();
                canvas.rawChildren.addChild(roundedMask);
            }

            private function image_resize(evt:ResizeEvent):void {
                var w:Number = evt.currentTarget.width;
                var h:Number = evt.currentTarget.height;
                var cornerRadius:uint = 60;
                roundedMask.graphics.clear();
                roundedMask.graphics.beginFill(0xFF0000);
                roundedMask.graphics.drawRoundRectComplex(0, 0,
                    w, h,
                    0, cornerRadius,
                    0, cornerRadius);
                roundedMask.graphics.endFill();
                image.mask = roundedMask;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Canvas id=&quot;canvas&quot;&gt;
        &lt;mx:Image id=&quot;image&quot;
                source=&quot;http://www.helpexamples.com/flash/images/image1.jpg&quot;
                resize=&quot;image_resize(event);&quot; /&gt;
    &lt;/mx:Canvas&gt;

&lt;/mx:Application&gt;
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p>@guy,</p>
<p>Instead of using the <code>drawRoundRect()</code> method, use the <code>drawRoundRectComplex()</code> method which allows you to specify the radius of each corner separately:</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/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;Image_mask_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>
<span style="color: #000000;">        initialize=<span style="color: #ff0000;">&quot;init();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.events.ResizeEvent;</span>
&nbsp;
<span style="color: #339933;">            private var roundedMask:Sprite;</span>
&nbsp;
<span style="color: #339933;">            private function init():void {</span>
<span style="color: #339933;">                roundedMask = new Sprite();</span>
<span style="color: #339933;">                canvas.rawChildren.addChild(roundedMask);</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            private function image_resize(evt:ResizeEvent):void {</span>
<span style="color: #339933;">                var w:Number = evt.currentTarget.width;</span>
<span style="color: #339933;">                var h:Number = evt.currentTarget.height;</span>
<span style="color: #339933;">                var cornerRadius:uint = 60;</span>
<span style="color: #339933;">                roundedMask.graphics.clear();</span>
<span style="color: #339933;">                roundedMask.graphics.beginFill(0xFF0000);</span>
<span style="color: #339933;">                roundedMask.graphics.drawRoundRectComplex(0, 0,</span>
<span style="color: #339933;">                    w, h,</span>
<span style="color: #339933;">                    0, cornerRadius,</span>
<span style="color: #339933;">                    0, cornerRadius);</span>
<span style="color: #339933;">                roundedMask.graphics.endFill();</span>
<span style="color: #339933;">                image.mask = roundedMask;</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> id=<span style="color: #ff0000;">&quot;canvas&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Image</span> id=<span style="color: #ff0000;">&quot;image&quot;</span></span>
<span style="color: #000000;">                source=<span style="color: #ff0000;">&quot;http://www.helpexamples.com/flash/images/image1.jpg&quot;</span></span>
<span style="color: #000000;">                resize=<span style="color: #ff0000;">&quot;image_resize(event);&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>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: guy</title>
		<link>http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/comment-page-1/#comment-6064</link>
		<dc:creator>guy</dc:creator>
		<pubDate>Tue, 20 Oct 2009 09:22:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/#comment-6064</guid>
		<description>Does anyone know how to round only the two corners on the right?</description>
		<content:encoded><![CDATA[<p>Does anyone know how to round only the two corners on the right?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon</title>
		<link>http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/comment-page-1/#comment-5236</link>
		<dc:creator>Brandon</dc:creator>
		<pubDate>Wed, 19 Aug 2009 03:59:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/#comment-5236</guid>
		<description>This example didn&#039;t work quite right when using it with a maxWidth or maxHeight, so I refactored it and posted the source &lt;a href=&quot;http://www.brandondement.com/blog/2009/06/21/creating-an-image-with-rounded-corners/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>This example didn&#8217;t work quite right when using it with a maxWidth or maxHeight, so I refactored it and posted the source <a href="http://www.brandondement.com/blog/2009/06/21/creating-an-image-with-rounded-corners/" rel="nofollow">here</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/comment-page-1/#comment-3800</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Sat, 20 Jun 2009 01:29:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/#comment-3800</guid>
		<description>Chris,

This seems to work for me:
&lt;pre class=&quot;code&quot;&gt;
&lt;mx:Image id=&quot;image&quot;
        source=&quot;@Embed(&#039;assets/fl_appicon.jpg&#039;)&quot;
        resize=&quot;image_resize(event);&quot; /&gt;
&lt;/pre&gt;

If yours isn&#039;t working, I&#039;d probably start by checking if that &lt;code&gt;resize&lt;/code&gt; event is ever dispatched. If not, perhaps try changing it to an &lt;code&gt;initialize&lt;/code&gt; or &lt;code&gt;creationComplete&lt;/code&gt; event handler and see if that does the trick.

Peter</description>
		<content:encoded><![CDATA[<p>Chris,</p>
<p>This seems to work for me:</p>
<pre class="code">
&lt;mx:Image id="image"
        source="@Embed('assets/fl_appicon.jpg')"
        resize="image_resize(event);" /&gt;
</pre>
<p>If yours isn&#8217;t working, I&#8217;d probably start by checking if that <code>resize</code> event is ever dispatched. If not, perhaps try changing it to an <code>initialize</code> or <code>creationComplete</code> event handler and see if that does the trick.</p>
<p>Peter</p>
]]></content:encoded>
	</item>
</channel>
</rss>
