<?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: Flex Example: Right-Click -&gt; Save Image As</title>
	<atom:link href="http://www.jamesward.com/2009/07/09/flex-example-right-click-save-image-as/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jamesward.com/2009/07/09/flex-example-right-click-save-image-as/</link>
	<description>Rich Internet Applications &#124; Flex &#124; Adobe AIR &#124; Java &#124; Open Source &#124; Linux &#124; Enterprise Software &#124; Cloud</description>
	<lastBuildDate>Wed, 10 Mar 2010 05:25:22 +0000</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Save Image As&#8230; now as a separate tag &#171; The Combined Corner</title>
		<link>http://www.jamesward.com/2009/07/09/flex-example-right-click-save-image-as/comment-page-1/#comment-157726</link>
		<dc:creator>Save Image As&#8230; now as a separate tag &#171; The Combined Corner</dc:creator>
		<pubDate>Thu, 13 Aug 2009 20:36:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.jamesward.org/wordpress/?p=144#comment-157726</guid>
		<description>[...] check out the original implementation by James Ward&#8230; it might suite your needs better&#8230; http://www.jamesward.com/blog/2009/07/09/flex-example-right-click-save-image-as/      leave a comment    &#171; EverythingFlex now on [...]</description>
		<content:encoded><![CDATA[<p>[...] check out the original implementation by James Ward&#8230; it might suite your needs better&#8230; <a href="http://www.jamesward.com/blog/2009/07/09/flex-example-right-click-save-image-as/" rel="nofollow">http://www.jamesward.com/blog/2009/07/09/flex-example-right-click-save-image-as/</a>      leave a comment    &laquo; EverythingFlex now on [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miha Blazin</title>
		<link>http://www.jamesward.com/2009/07/09/flex-example-right-click-save-image-as/comment-page-1/#comment-157582</link>
		<dc:creator>Miha Blazin</dc:creator>
		<pubDate>Tue, 14 Jul 2009 08:39:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.jamesward.org/wordpress/?p=144#comment-157582</guid>
		<description>I think your sample is great and a thing that constantly gets forgotten when building RIAs with Flex. I do agree the Flex components should provide this functionality (if not by default then at least as a property to set).  I do find it weird although, why Acrobat.com Buzzword application ignores the right click context menu features and instead shows a new button everytime you select some text, which makes it really unnaturaly to work with a Rich Text Editor (at least in the traditional way).  Is that perhaps because the right click is (or will be) a problem on some platforms that support (or will support) the Adobe Flash Platofrm - like Mobile devices.</description>
		<content:encoded><![CDATA[<p>I think your sample is great and a thing that constantly gets forgotten when building RIAs with Flex. I do agree the Flex components should provide this functionality (if not by default then at least as a property to set).  I do find it weird although, why Acrobat.com Buzzword application ignores the right click context menu features and instead shows a new button everytime you select some text, which makes it really unnaturaly to work with a Rich Text Editor (at least in the traditional way).  Is that perhaps because the right click is (or will be) a problem on some platforms that support (or will support) the Adobe Flash Platofrm &#8211; like Mobile devices.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nehul</title>
		<link>http://www.jamesward.com/2009/07/09/flex-example-right-click-save-image-as/comment-page-1/#comment-157581</link>
		<dc:creator>Nehul</dc:creator>
		<pubDate>Tue, 14 Jul 2009 00:11:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.jamesward.org/wordpress/?p=144#comment-157581</guid>
		<description>one more thing in your MXML do this 

&lt;custom:SavableImage id=&quot;saveImage&quot;  name=&quot;&quot; &gt;

in above code filename will be image name coming from server. I have file name set in database column and actual file on server. So it was pretty easy to replace filename to {javadto.imagefilename}

Now in actionscript 

===========================
var bmp:Bitmap = Bitmap(this.content);
var myEncoder:JPGEncoder = new JPGEncoder(75);
var byte:ByteArray = myEncoder.encode(bmp.bitmapData);
var fr:FileReference = new FileReference();
fr.save(byte, this.name);
=========================

save dialog will have same file name as source.</description>
		<content:encoded><![CDATA[<p>one more thing in your MXML do this </p>
<p>&lt;custom:SavableImage id=&quot;saveImage&quot;  name=&quot;&#8221; &gt;</p>
<p>in above code filename will be image name coming from server. I have file name set in database column and actual file on server. So it was pretty easy to replace filename to {javadto.imagefilename}</p>
<p>Now in actionscript </p>
<p>===========================<br />
var bmp:Bitmap = Bitmap(this.content);<br />
var myEncoder:JPGEncoder = new JPGEncoder(75);<br />
var byte:ByteArray = myEncoder.encode(bmp.bitmapData);<br />
var fr:FileReference = new FileReference();<br />
fr.save(byte, this.name);<br />
=========================</p>
<p>save dialog will have same file name as source.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nehul</title>
		<link>http://www.jamesward.com/2009/07/09/flex-example-right-click-save-image-as/comment-page-1/#comment-157580</link>
		<dc:creator>Nehul</dc:creator>
		<pubDate>Mon, 13 Jul 2009 23:48:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.jamesward.org/wordpress/?p=144#comment-157580</guid>
		<description>I have re-encode the image on client here is the source

===========================
    var bmp:Bitmap = Bitmap(this.content);
    var myEncoder:JPGEncoder = new JPGEncoder(75);
    var byte:ByteArray = myEncoder.encode(bmp.bitmapData);      
    var fr:FileReference = new FileReference();
    fr.save(byte, &quot;test.jpg&quot;);      
=========================

You have add this in saveImageAs  function in source file SaveableImage.cs in Jamesward packge.

You need two additional file JPGEncodeer.as and BitString.as for conversion on client side. I can&#039;t attach them on blog.</description>
		<content:encoded><![CDATA[<p>I have re-encode the image on client here is the source</p>
<p>===========================<br />
    var bmp:Bitmap = Bitmap(this.content);<br />
    var myEncoder:JPGEncoder = new JPGEncoder(75);<br />
    var byte:ByteArray = myEncoder.encode(bmp.bitmapData);<br />
    var fr:FileReference = new FileReference();<br />
    fr.save(byte, &#8220;test.jpg&#8221;);<br />
=========================</p>
<p>You have add this in saveImageAs  function in source file SaveableImage.cs in Jamesward packge.</p>
<p>You need two additional file JPGEncodeer.as and BitString.as for conversion on client side. I can&#8217;t attach them on blog.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nae2</title>
		<link>http://www.jamesward.com/2009/07/09/flex-example-right-click-save-image-as/comment-page-1/#comment-157571</link>
		<dc:creator>nae2</dc:creator>
		<pubDate>Thu, 09 Jul 2009 21:02:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.jamesward.org/wordpress/?p=144#comment-157571</guid>
		<description>Thanks for quick response. Mostly in my apps I use 1st and 3rd option: fetch it again from server or re-encode the image with PNGEncoder.
I&#039;ve never saw or used this hack, but i&#039;ts good to know that such thing exists :)</description>
		<content:encoded><![CDATA[<p>Thanks for quick response. Mostly in my apps I use 1st and 3rd option: fetch it again from server or re-encode the image with PNGEncoder.<br />
I&#8217;ve never saw or used this hack, but i&#8217;ts good to know that such thing exists :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Ward</title>
		<link>http://www.jamesward.com/2009/07/09/flex-example-right-click-save-image-as/comment-page-1/#comment-157570</link>
		<dc:creator>James Ward</dc:creator>
		<pubDate>Thu, 09 Jul 2009 19:52:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.jamesward.org/wordpress/?p=144#comment-157570</guid>
		<description>Hi nae2,

The contents of content.loaderInfo.bytes isn&#039;t the image but rather the image embedded in a SWF.  So I&#039;m pulling the image out of the SWF by chopping off the first 49 bytes and then the last 17 bytes.  I have no idea what&#039;s in those bytes or if it&#039;s always 49 and 17.  So this needs some testing.

Alternatively there are a few other ways to do this:
 - Re-fetch the image from the server
 - Maybe find some place in memory where the non-SWF-ified image is and use those bytes
 - Re-encode the image on the client

I opted to mess with the bytes instead of those options.  But maybe someone smarter than me can find a cleaner way to do this.

-James</description>
		<content:encoded><![CDATA[<p>Hi nae2,</p>
<p>The contents of content.loaderInfo.bytes isn&#8217;t the image but rather the image embedded in a SWF.  So I&#8217;m pulling the image out of the SWF by chopping off the first 49 bytes and then the last 17 bytes.  I have no idea what&#8217;s in those bytes or if it&#8217;s always 49 and 17.  So this needs some testing.</p>
<p>Alternatively there are a few other ways to do this:<br />
 &#8211; Re-fetch the image from the server<br />
 &#8211; Maybe find some place in memory where the non-SWF-ified image is and use those bytes<br />
 &#8211; Re-encode the image on the client</p>
<p>I opted to mess with the bytes instead of those options.  But maybe someone smarter than me can find a cleaner way to do this.</p>
<p>-James</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nae2</title>
		<link>http://www.jamesward.com/2009/07/09/flex-example-right-click-save-image-as/comment-page-1/#comment-157569</link>
		<dc:creator>nae2</dc:creator>
		<pubDate>Thu, 09 Jul 2009 19:45:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.jamesward.org/wordpress/?p=144#comment-157569</guid>
		<description>&gt;     content.loaderInfo.bytes.readBytes(tba, 0, (content.loaderInfo.bytes.length - 17));
&gt;     tba.position = 49;

Can you explain why you&#039;re substracting 17 from image bytes length  and set position to 49 in saveImageAs function?</description>
		<content:encoded><![CDATA[<p>&gt;     content.loaderInfo.bytes.readBytes(tba, 0, (content.loaderInfo.bytes.length &#8211; 17));<br />
&gt;     tba.position = 49;</p>
<p>Can you explain why you&#8217;re substracting 17 from image bytes length  and set position to 49 in saveImageAs function?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grzegorz ?obi?ski</title>
		<link>http://www.jamesward.com/2009/07/09/flex-example-right-click-save-image-as/comment-page-1/#comment-157568</link>
		<dc:creator>Grzegorz ?obi?ski</dc:creator>
		<pubDate>Thu, 09 Jul 2009 19:35:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.jamesward.org/wordpress/?p=144#comment-157568</guid>
		<description>Thank you James, nice work. I found it helpful.</description>
		<content:encoded><![CDATA[<p>Thank you James, nice work. I found it helpful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dmendels</title>
		<link>http://www.jamesward.com/2009/07/09/flex-example-right-click-save-image-as/comment-page-1/#comment-157566</link>
		<dc:creator>dmendels</dc:creator>
		<pubDate>Thu, 09 Jul 2009 17:42:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.jamesward.org/wordpress/?p=144#comment-157566</guid>
		<description>Nice!  I wanted this feature for years (it still should be a default option but I am glad it can be done) :)</description>
		<content:encoded><![CDATA[<p>Nice!  I wanted this feature for years (it still should be a default option but I am glad it can be done) :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
