<?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>James Ward - RIA Cowboy &#187; Flash Player</title>
	<atom:link href="http://www.jamesward.com/category/flash-platform/flash_player/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jamesward.com</link>
	<description>Rich Internet Applications &#124; Flex &#124; Adobe AIR &#124; Java &#124; Open Source &#124; Linux &#124; Enterprise Software &#124; Cloud</description>
	<lastBuildDate>Tue, 24 Aug 2010 16:03:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Developing Mobile Flash / Flex &#8211; Scaling and Zooming</title>
		<link>http://www.jamesward.com/2010/07/19/developing-mobile-flash-flex-scaling-and-zooming/</link>
		<comments>http://www.jamesward.com/2010/07/19/developing-mobile-flash-flex-scaling-and-zooming/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 18:29:10 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/?p=1874</guid>
		<description><![CDATA[Mobile development with Flash and Flex is a new frontier, full of new adventures and discoveries. Recently I discovered something that might be useful to you. By default the mobile web browser on my Android 2.2 device scales a web page to make more room to display pages typically built for a desktop profile. Here [...]]]></description>
			<content:encoded><![CDATA[<p>Mobile development with Flash and Flex is a new frontier, full of new adventures and discoveries.  Recently I discovered something that might be useful to you.  By default the mobile web browser on my Android 2.2 device scales a web page to make more room to display pages typically built for a desktop profile.  Here is what a little <a href="http://www.jamesward.com/demos/MobileSizeTest/MobileSizeTest.html">test mobile Flex app</a> I built looks like:<br />
<img src="http://www.jamesward.com/wp/uploads/2010/07/mobile_flash-default.png" width="480" height="800" style="border: 1px solid black"/></p>
<p>Strange!  The width and height are larger than the screen resolution.  You can fix this by adding the following to the HTML page:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;meta</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;viewport&quot;</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">&quot;target-densityDpi=device-dpi; user-scalable=0;&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>And now it will look like:<br />
<img src="http://www.jamesward.com/wp/uploads/2010/07/mobile_flash-noscale.png" alt="" title="mobile_flash-noscale" width="480" height="800" style="border: 1px solid black"/></p>
<p>Now that looks right!  This also turns off the two-finger / pinch zooming feature for the page (which is more important for content that hasn&#8217;t been optimized for a mobile profile).</p>
<p>I hope this is useful for those of you embarking on new adventures with Flash / Flex on mobile devices!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2010/07/19/developing-mobile-flash-flex-scaling-and-zooming/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>amf.js &#8211; A Pure JavaScript AMF Implementation</title>
		<link>http://www.jamesward.com/2010/07/07/amf-js-a-pure-javascript-amf-implementation/</link>
		<comments>http://www.jamesward.com/2010/07/07/amf-js-a-pure-javascript-amf-implementation/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 15:34:06 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/?p=1846</guid>
		<description><![CDATA[I just finished the first version of a new pure JavaScript library for AMF. I&#8217;ve wanted to do this for a while but didn&#8217;t think it was possible since JavaScript doesn&#8217;t have a ByteArray. But then I came across this: &#8220;High Performance JavaScript Port of ActionScript&#8217;s ByteArray&#8220;. That became the basis for amf.js. Before I [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished the first version of a new pure <a href="http://github.com/jlward4th/JSAMF">JavaScript library for AMF</a>.  I&#8217;ve wanted to do this for a while but didn&#8217;t think it was possible since JavaScript doesn&#8217;t have a ByteArray.  But then I came across this: &#8220;<a href="http://www.adamia.com/blog/high-performance-javascript-port-of-actionscript-byteArray">High Performance JavaScript Port of ActionScript&#8217;s ByteArray</a>&#8220;.  That became the basis for <a href="http://github.com/jlward4th/JSAMF">amf.js</a>.  Before I get into the gory details of how this works, check out some developer eye candy:<br />
<a href="http://www.jamesward.com/demos/JSAMF/censusTest.html" target="_new">http://www.jamesward.com/demos/JSAMF/censusTest.html</a></p>
<p>Ok, hopefully that worked for you.  I&#8217;ve tested this in the latest Chrome, Firefox, Safari, and IE and they all seem to work.  It should also work on your iPad, iPhone, or Android device.</p>
<p>Now for those gory details&#8230;  AMF is a protocol initially created in Flash Player as a way to serialize data for storage on disk or transfer over a network.  Typically in web apps we use text-based serialization protocols (like JSON or RESTful XML) for data transfer.  But there are some advantages to using binary protocols &#8211; primarily <a href="http://www.jamesward.com/2009/06/17/blazing-fast-data-transfer-in-flex/">much better performance</a>.  There are two versions of the AMF protocol, <a href="http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf">AMF0</a> and <a href="http://opensource.adobe.com/wiki/download/attachments/1114283/amf3_spec_05_05_08.pdf">AMF3</a>.  Both are publicly documented by Adobe and numerous server-side implementations of AMF exist.  AMF is just a serialization technology, not a transport.  So you can put AMF encoded data into any transport (like HTTP / HTTPS).  Typically Flash Player is the client that reads / writes AMF data.</p>
<p>I recently had a conversation with <a href="http://twitter.com/Stephan007">Stephan Janssen</a> who runs <a href="http://parleys.com">Parleys.com</a> (an amazing Flex app), which started me on this fun project. The Parleys.com PC-profile web client and the Adobe AIR desktop client both use BlazeDS and AMF as the primary serialization protocol for moving data between client and server.  This is a great choice for those clients because it makes the apps snappy.  But for the HTML5 client Stephan wants to reuse his AMF endpoints.  This is where amf.js comes in.</p>
<p>Flash Player has a ByteArray API that can be used for a lot of amazing things.  One of those things is to read and write AMF.  If you have an object in Flash Player and you create a new ByteArray and then call &#8220;byteArray.writeObject(myObject)&#8221; you will get a ByteArray with the AMF representation of that object.  Likewise if you get some AMF and you call &#8220;byteArray.readObject()&#8221; you get the object(s) from the AMF.  In Flex there are high level APIs (like RemoteObject, Consumer, etc.) that use this native AMF support in Flash Player.</p>
<p>To create a pure JavaScript AMF library the first thing that is needed is a pure JavaScript ByteArray library since JavaScript doesn&#8217;t natively have one.  I used one from <a href="http://www.adamia.com/blog/high-performance-javascript-port-of-actionscript-byteArray">adamia.com</a> since it was similar to the ByteArray in Flash Player, seemed fast, and seemed to parse floats correctly.  This ByteArray has some of the basic functions like readByte, readFloat, etc.  But what about that cool readObject function?  Well, that has to be built from scratch.  And it should support both AMF0 and AMF3.</p>
<p>Using the AMF specs and code from BlazeDS &#038; pyamf as a reference I was able to add the other functions to the ByteArray.  But there was a problem.  Using XMLHttpRequest as the method of getting the AMF was not working right.  Some bytes were incorrect.  It turns out XMLHttpRequest uses UTF-8 and that screws up some of the bytes above 128.  I tried other charsets and each one would change some range of bytes.  That is not good because I need the bytes to be exactly what the server sent.  Then I came across <a href="http://web.archive.org/web/20061114143134/http://mgran.blogspot.com/2006/08/downloading-binary-streams-with.html">this gem</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//XHR binary charset opt by Marcus Granado 2006 [http://mgran.blogspot.com]</span>
req.<span style="color: #660066;">overrideMimeType</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'text/plain; charset=x-user-defined'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Using the &#8220;x-user-defined&#8221; charset left the bytes alone.  Perfect!  Except that IE doesn&#8217;t support the req.overrideMimeType function.  But IE does actually have a real ByteArray available in req.responseBody via VBScript.  For now in IE I just change the ByteArray into a string (like req.responseText in the other browsers) although a lot of optimization could be done to just use the VBScript ByteArray directly.</p>
<p>Right now amf.js is just a basic JavaScript library for reading AMF data.  It doesn&#8217;t support using a BlazeDS MessageBrokerServlet yet because I need to be able to assemble a AMF object in JavaScript and send that in the HTTP request to the servlet.  But it works fine with a custom servlet that uses BlazeDS&#8217;s AMF library to just write AMF into the HTTP response.  It should also work with pyamf, AMFPHP, and other AMF server libraries.</p>
<p>To use amf.js start by dumping some AMF into an HTTP response.  In Java with BlazeDS I did this:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> doGet<span style="color: #009900;">&#40;</span>HttpServletRequest request, HttpServletResponse response<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> ServletException, <span style="color: #003399;">IOException</span>
<span style="color: #009900;">&#123;</span>
    response.<span style="color: #006633;">setHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span>, <span style="color: #0000ff;">&quot;application/x-amf;charset=x-user-defined&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ServletOutputStream out <span style="color: #339933;">=</span> response.<span style="color: #006633;">getOutputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ActionMessage requestMessage <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ActionMessage<span style="color: #009900;">&#40;</span>MessageIOConstants.<span style="color: #006633;">AMF3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    MessageBody amfMessage <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MessageBody<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    amfMessage.<span style="color: #006633;">setData</span><span style="color: #009900;">&#40;</span>someSerializableObject<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    requestMessage.<span style="color: #006633;">addBody</span><span style="color: #009900;">&#40;</span>amfMessage<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    AmfMessageSerializer amfMessageSerializer <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AmfMessageSerializer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    amfMessageSerializer.<span style="color: #006633;">initialize</span><span style="color: #009900;">&#40;</span>SerializationContext.<span style="color: #006633;">getSerializationContext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, out, <span style="color: #000000; font-weight: bold;">new</span> AmfTrace<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    amfMessageSerializer.<span style="color: #006633;">writeMessage</span><span style="color: #009900;">&#40;</span>requestMessage<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    out.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In a HTML web page add the amf.js script:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;amf.js&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>In JavaScript make a XHR request for some data:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> url <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;TestServlet&quot;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> req<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> getAMF<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">ActiveXObject</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        req <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> ActiveXObject<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Microsoft.XMLHTTP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">XMLHttpRequest</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        req <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> XMLHttpRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">//XHR binary charset opt by Marcus Granado 2006 [http://mgran.blogspot.com]</span>
        req.<span style="color: #660066;">overrideMimeType</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'text/plain; charset=x-user-defined'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    req.<span style="color: #660066;">onreadystatechange</span> <span style="color: #339933;">=</span> processReqChange<span style="color: #339933;">;</span>
    req.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;GET&quot;</span><span style="color: #339933;">,</span> url<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    req.<span style="color: #660066;">send</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And when the response comes back decode the AMF:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> processReqChange<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #660066;">readyState</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">4</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #000066;">status</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> o <span style="color: #339933;">=</span> decodeAMF<span style="color: #009900;">&#40;</span>req.<span style="color: #660066;">responseText</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">messages</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">body</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">else</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;There was a problem retrieving the data:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">+</span> req.<span style="color: #660066;">statusText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>For details on how to support IE, check out the source code for <a href="http://www.jamesward.com/demos/JSAMF/censusTest.html">censusTest.html</a>.</p>
<p>While amf.js works in my tests there is more work to be done.  I need to add the write functions so that AMF can be sent to the server.  Then supporting BlazeDS&#8217;s MessageBrokerServlet should be pretty straightforward.  I&#8217;d also like to create pure JavaScript implementations of Flex&#8217;s RemoteObject, Consumer, and Producer APIs.  Also, I need people to test amf.js with their AMF to make sure that I&#8217;ve implemented things correctly.  All of the <a href="http://github.com/jlward4th/JSAMF">code is on github.com</a> so go ahead and fork it!  Let me know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2010/07/07/amf-js-a-pure-javascript-amf-implementation/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
		</item>
		<item>
		<title>Tour de Flex 2.0 &#8211; Nearly 500 Flex Examples!</title>
		<link>http://www.jamesward.com/2010/06/21/tour-de-flex-2-0-nearly-500-flex-examples/</link>
		<comments>http://www.jamesward.com/2010/06/21/tour-de-flex-2-0-nearly-500-flex-examples/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 15:45:42 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/?p=1827</guid>
		<description><![CDATA[Adobe has just launched the new AIR 2 based Tour de Flex version 2.0 which now contains almost 500 Flex examples! The new version has new AIR 2 examples (only available in the AIR version of Tour de Flex) including: File Promises Mass Storage Detection Native Process Open with default app Socket Server Also there [...]]]></description>
			<content:encoded><![CDATA[<p>Adobe has just launched the new AIR 2 based <a href="http://flex.org/tour">Tour de Flex version 2.0</a> which now contains almost 500 Flex examples!  The new version has new AIR 2 examples (only available in the AIR version of Tour de Flex) including:</p>
<ul>
<li>File Promises</li>
<li>Mass Storage Detection</li>
<li>Native Process</li>
<li>Open with default app</li>
<li>Socket Server</li>
</ul>
<p>Also there are some great examples of the new Flash Player 10.1 and AIR 2 APIs including:</p>
<ul>
<li>Gestures</li>
<li>Global Error Handler</li>
<li>Globalization / Internationalization</li>
<li>Microphone access</li>
</ul>
<p>Those are some great examples but my favorite is still <a href="http://dougmccune.com/blog/">Doug McCune&#8217;s</a> <a href="http://www.adobe.com/devnet/flex/tourdeflex/web/#docIndex=0;illustIndex=0;sampleId=16300">Physics Form</a> followed closely by the <a href="http://www.adobe.com/devnet/flex/tourdeflex/web/#docIndex=-1;illustIndex=0;sampleId=14050">real-time Tour de Flex Dashboard</a>.  :)</p>
<p>If you already have Tour de Flex installed then it should auto update to the latest version when you launch it.  Otherwise install it now using the badge installer below.<br />
<iframe width="216" height="182" frameborder=0 scrolling="no" src="http://tourdeflex.adobe.com/badge/"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2010/06/21/tour-de-flex-2-0-nearly-500-flex-examples/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Flex on Android in Flash Player and AIR</title>
		<link>http://www.jamesward.com/2010/05/21/flex-on-android-in-flash-player-and-air/</link>
		<comments>http://www.jamesward.com/2010/05/21/flex-on-android-in-flash-player-and-air/#comments</comments>
		<pubDate>Fri, 21 May 2010 16:07:18 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/?p=1743</guid>
		<description><![CDATA[This week at the Google I/O conference Adobe announced that a Flash Player 10.1 beta and an Adobe AIR prerelease are now available for Android devices. This is really exciting news for those of us building apps on the Flash Platform because now we can begin building apps in Flex for these mobile devices (and [...]]]></description>
			<content:encoded><![CDATA[<p>This week at the Google I/O conference Adobe announced that a Flash Player 10.1 beta and an Adobe AIR prerelease are now available for Android devices.  This is really exciting news for those of us building apps on the Flash Platform because now we can begin building apps in Flex for these mobile devices (and many others coming soon).</p>
<p>Take a look a some of the quick demos I&#8217;ve built with Flex running on Android in Flash Player and AIR:<br />
<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/Zp7leMUo2NY&#038;hl=en_US&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Zp7leMUo2NY&#038;hl=en_US&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object><br />
You can get the source code for all of these demos from <a href="http://github.com/jlward4th">github</a>.</p>
<p>Also <a href="http://coenraets.org">Christophe Coenraets</a> has posted some great Flex mobile demos.  Check out his <a href="http://coenraets.org/blog/2010/05/sample-application-using-flex-and-air-for-android/">Employee Directory</a> and <a href="http://coenraets.org/blog/2010/05/android-trader-application-with-flex-4-and-air/">Stock Trader</a> demos.</p>
<p>These are very exciting times for developers!</p>
<p>If you want to check out the Flash Player 10.1 beta for Android it will be available in the Android Marketplace for Android 2.2 devices.  You can try Adobe AIR for Android today by <a href="http://blogs.adobe.com/air/2010/05/air_android_prerelease.html">signing up for the prerelease</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2010/05/21/flex-on-android-in-flash-player-and-air/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Flex Performance on Mobile Devices</title>
		<link>http://www.jamesward.com/2010/02/21/flex-performance-on-mobile-devices/</link>
		<comments>http://www.jamesward.com/2010/02/21/flex-performance-on-mobile-devices/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 20:46:24 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/?p=1574</guid>
		<description><![CDATA[This past weekend I spent an hour optimizing the Flex 4 scrolling demo that I posted last week. The original demo was intended to show how to hook up touch events to the Flex 4 List / DataGroup controls. This new version adds some optimizations for the touch event handling and adds the kinetic flick [...]]]></description>
			<content:encoded><![CDATA[<p>This past weekend I spent an hour optimizing the <a href="http://www.jamesward.com/2010/02/19/flex-4-list-scrolling-on-android-with-flash-player-10-1/">Flex 4 scrolling demo</a> that I posted last week.  The original demo was intended to show how to hook up touch events to the Flex 4 List / DataGroup controls.  This new version adds some optimizations for the touch event handling and adds the kinetic flick behavior.  Check it out and let me know what you think:</p>
<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/2ko7NAtF1r0&#038;hl=en_US&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/2ko7NAtF1r0&#038;hl=en_US&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object></p>
<p>I&#8217;ve posted <a href="http://www.jamesward.com/demos/MobileListSwipe2/srcview/">the code</a> for this second version of the <a href="http://www.jamesward.com/demos/MobileListSwipe2/MobileListSwipe2.html">touch scrolling demo</a>.  It was pretty trivial to optimize it this far.  With a little more work it&#8217;ll be as smooth as silk and as fast as Apolo Ohno.  :)</p>
<p>Over the past few days I&#8217;ve received some questions about the performance of Flex apps on mobile devices.  My <a href="http://www.jamesward.com/census">Census RIA Benchmark</a> has been a great way to compare the performance of various data loading techniques and technologies.  Now that I have my Android based Nexus One mobile device with an early build of Flash Player 10.1 I wanted to see how fast I could load and render large amounts of data in a Flex application.  I&#8217;m really impressed with the results!  20,000 rows of data loaded from the server and rendered on my phone in about 2 seconds!  Those 20,000 rows can then be sorted on the device instantaneously.  Pretty amazing performance for such a little device!  Check out the video:</p>
<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/KQkSsmA_lFo&#038;hl=en_US&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/KQkSsmA_lFo&#038;hl=en_US&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object></p>
<p>You can run the mobile version of the <a href="http://www.jamesward.com/demos/MobileCensus/MobileCensus.html">Flex AMF Census Test</a> and check out the <a href="http://www.jamesward.com/demos/MobileCensus/srcview/index.html">source code</a>.  Let me know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2010/02/21/flex-performance-on-mobile-devices/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Flex 4 List Scrolling on Android with Flash Player 10.1</title>
		<link>http://www.jamesward.com/2010/02/19/flex-4-list-scrolling-on-android-with-flash-player-10-1/</link>
		<comments>http://www.jamesward.com/2010/02/19/flex-4-list-scrolling-on-android-with-flash-player-10-1/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 21:53:56 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/?p=1563</guid>
		<description><![CDATA[UPDATE 1: The first version of this demo was intended to show how to hook up touch events to the Flex 4 List / DataGroup controls. I&#8217;ve posted a new version that adds some optimizations for the touch event handling and adds the kinetic flick behavior. One of the challenges of running existing web content [...]]]></description>
			<content:encoded><![CDATA[<p><font color="#ff0000">UPDATE 1: The first version of this demo was intended to show how to hook up touch events to the Flex 4 List / DataGroup controls. I&#8217;ve posted <a href="http://www.jamesward.com/2010/02/21/flex-performance-on-mobile-devices/">a new version</a> that adds some optimizations for the touch event handling and adds the kinetic flick behavior.</font></p>
<p>One of the challenges of running existing web content on mobile devices is that user interactions differ between mediums.  For instance, on a normal computer with a mouse, scrolling though lists is often done by clicking on scroll bars or mouse wheels.  On mobile devices that lack a pointing device this is not the best interaction paradigm.  On devices with touch screens the paradigm for scrolling is usually a swipe gesture.</p>
<p>In Flash Player 10.1 there are APIs for gestures and multitouch events.  I thought it would be fun to hook up the list scrolling on a Flex 4 List to the <a href="http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/events/TouchEvent.html#TOUCH_MOVE">TouchEvent</a> on my Nexus One.  Check out the video:</p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/QOJz1BnHCW0&#038;hl=en_US&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/QOJz1BnHCW0&#038;hl=en_US&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<p>If you want to see how I created this <a href="http://www.jamesward.com/demos/MobileListSwipe/MobileListSwipe.html">simple demo</a>, check out the <a href="http://www.jamesward.com/demos/MobileListSwipe/srcview/">source code</a>.  Let me know if you have any questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2010/02/19/flex-4-list-scrolling-on-android-with-flash-player-10-1/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Flex Apps on Mobile Devices</title>
		<link>http://www.jamesward.com/2010/02/17/flex-apps-on-mobile-devices/</link>
		<comments>http://www.jamesward.com/2010/02/17/flex-apps-on-mobile-devices/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 20:57:19 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/?p=1556</guid>
		<description><![CDATA[This week at Mobile World Congress Adobe has been showing off Flash Player 10.1 on a variety of mobile devices. Last week I received Google&#8217;s Nexus One device with an early version of Flash Player 10.1 on it. Here is a video I shot today showing how Flex applications can run on mobile devices with [...]]]></description>
			<content:encoded><![CDATA[<p>This week at Mobile World Congress Adobe has been <a href="http://www.adobe.com/aboutadobe/pressroom/pressreleases/201002/021510FlashPlayerMWC.html">showing off Flash Player 10.1</a> on a variety of mobile devices.  Last week I received Google&#8217;s Nexus One device with an early version of Flash Player 10.1 on it.  Here is a video I shot today showing how Flex applications can run on mobile devices with Flash Player 10.1 and how existing applications can be tweaked for the size constraints of these devices.  Let me know what you think.<br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="640" height="402" id="viddler_d7688586"><param name="movie" value="http://www.viddler.com/player/d7688586/" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><embed src="http://www.viddler.com/player/d7688586/" width="640" height="402" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" name="viddler_d7688586"></embed></object></p>
<p>BTW: The app I created for the demo is available at <a href="http://bit.ly/tdfmdb">bit.ly/tdfmdb</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2010/02/17/flex-apps-on-mobile-devices/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Flex and The Cloud</title>
		<link>http://www.jamesward.com/2010/01/19/flex-and-the-cloud-2/</link>
		<comments>http://www.jamesward.com/2010/01/19/flex-and-the-cloud-2/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 22:49:53 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/?p=1490</guid>
		<description><![CDATA[The combination of Flex and The Cloud is quickly becoming an IT and paradigm changing combination. Here are a number of recently published resources for learning more about this : An article I wrote has been published on the online Flash &#38; Flex Developer&#8217;s Magazine: Flex and The Cloud: Is this really just Client/Server 2.0? [...]]]></description>
			<content:encoded><![CDATA[<p>The combination of Flex and The Cloud is quickly becoming an IT and paradigm changing combination.  Here are a number of recently published resources for learning more about this :</p>
<ul>
<li>An article I wrote has been published on the online Flash &amp; Flex Developer&#8217;s Magazine: <a href="http://ffdmag.com/download-1-2010">Flex and The Cloud: Is this really just Client/Server 2.0?</a></li>
<li>I&#8217;ll be speaking on <a href="http://ria5280.org/calendar/event/2010/2/18/163821">Thursday, February 18 2010 at the Denver Flex User Group</a> about Flex and The Cloud</li>
<li>The <a href="http://www.adobe.com/cfusion/event/index.cfm?event=list&#038;loc=en_us&#038;type=ondemand_seminar&#038;product=&#038;interest=int_rich_internet_applications&#038;audience=&#038;sdid=EGMQU">recording of a webinar</a> I co-hosted on the new Salesforce.com Cloud platform for developers has been posted</li>
<li>Jeff Douglas has posted <a href="http://blog.jeffdouglas.com/2010/01/11/developing-apps-with-the-stratus-framework/">a video walk through</a> showing how to use the new Salesforce.com Flash Builder 4 extension for Flex + Cloud apps</li>
</ul>
<p>Exciting stuff!  Let me know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2010/01/19/flex-and-the-cloud-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Exciting Flash Platform Advancements</title>
		<link>http://www.jamesward.com/2009/12/16/exciting-flash-platform-advancements/</link>
		<comments>http://www.jamesward.com/2009/12/16/exciting-flash-platform-advancements/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 20:56:44 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flash Player]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/blog/?p=1375</guid>
		<description><![CDATA[Recently there has been a number of exciting advancements with the Flash Platform (Flex, Flash Player, and Adobe AIR). Here is a quick round-up: Adobe released security updates for the Flash runtimes: Flash Player 10.0.42.34 and Adobe AIR 1.5.3. The Flash Player update fixes an issue with mouse scroll wheels not working in Flash when [...]]]></description>
			<content:encoded><![CDATA[<p>Recently there has been a number of exciting advancements with the Flash Platform (Flex, Flash Player, and Adobe AIR).  Here is a quick round-up:</p>
<p>Adobe released security updates for the Flash runtimes: <a href="http://www.adobe.com/go/gntray_dl_getflashplayer">Flash Player 10.0.42.34</a> and <a href="http://www.adobe.com/go/gntray_dl_getair">Adobe AIR 1.5.3</a>.  The Flash Player update fixes an issue with <a href="http://bugs.adobe.com/jira/browse/FP-503">mouse scroll wheels not working in Flash when using Safari</a>.</p>
<p>Recently, Adobe also released public betas for <a href="http://labs.adobe.com/technologies/air2/">Adobe AIR 2</a> and <a href="http://labs.adobe.com/downloads/flashplayer10.html">Flash Player 10.1</a>.  This Flash Player release fixes the &#8220;<a href="http://bugs.adobe.com/jira/browse/FP-40">Incorrect unicode input in Linux</a>&#8221; bug.  Both AIR 2 and Flash Player 10.1 have a new API for Global Exception Handling (which was <a href="http://bugs.adobe.com/jira/browse/FP-444">one of the highest rated feature requests</a> on <a href="http://bugs.adobe.com">bugs.adobe.com</a>).  Check out <a href="http://flex.org/tour">Tour de Flex</a> for some new samples on how to use this new and other new APIs.</p>
<p>For those looking to build Flex applications in the enterprise, Adobe has posted two great resources.  First is a <a href="http://www.adobe.com/products/player_census/flashplayer/enterprise_penetration.html">third-party study</a> that says <b>enterprise penetration of Flash Player 9 (or better) is at 97.6%!</b>  Second is a fantastic white paper about <a href="http://www.flashforbiz.com/Index.asp">The Business Benefits of Rich Internet Applications</a> &#8211; a must read for anyone in the enterprise who is evaluating Flex.</p>
<p>Last is a short video of me at Adobe MAX 2009 where I talk about the progress that Adobe is making in getting the Flash Platform onto the many screens in our lives and why that is exciting for developers.  Let me know what you think!<br />
<object width="425" height="256"><param name="movie" value="http://images.tv.adobe.com//swf/player.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="FlashVars" value="fileID=4141&#038;context=76&#038;embeded=true&#038;environment=production"></param><embed src="http://images.tv.adobe.com//swf/player.swf" flashvars="fileID=4141&#038;context=76&#038;embeded=true&#038;environment=production" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="256"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2009/12/16/exciting-flash-platform-advancements/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How Bad Crossdomain Policies Expose Protected Data to Malicious Applications</title>
		<link>http://www.jamesward.com/2009/11/08/how-bad-crossdomain-policies-expose-protected-data-to-malicious-applications/</link>
		<comments>http://www.jamesward.com/2009/11/08/how-bad-crossdomain-policies-expose-protected-data-to-malicious-applications/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 10:15:22 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/blog/?p=1323</guid>
		<description><![CDATA[The web&#8217;s success has been partially due to the sandbox it provides users. Users do not generally have to entirely trust every website they visit because malicious web sites should be sandboxed from doing the user harm. One way that web sites are sandboxed is through a same-origin policy. By default any code that runs [...]]]></description>
			<content:encoded><![CDATA[<p>The web&#8217;s success has been partially due to the sandbox it provides users.  Users do not generally have to entirely trust every website they visit because malicious web sites should be sandboxed from doing the user harm.  One way that web sites are sandboxed is through a same-origin policy.  By default any code that runs inside a web browser can only access data from the domain in which the code originated from.  So if code (JavaScript, Flash, etc) loads from the foo.com domain then it can&#8217;t access data on the bar.com domain.  The code may be able to make requests to bar.com but the code from foo.com shouldn&#8217;t be able to read or access the results of those requests.</p>
<p>Since Rich Internet Applications built with Flex, Silverlight, etc usually try to do more on the client side, for example mash-up data from multiple sites, the same-origin policy presents a problem.</p>
<p>In most cases Flash Player sticks with the typical browser sandbox concepts.  But there are a few places where it goes outside this boundary such as with microphone and webcam access.  Another area is by allowing opt-in to cross-domain communication bypassing the browser&#8217;s regular same-origin policy.  Other plugins such as Silverlight and JavaFX also do this.  This cross-domain capability is powerful but also <a href="http://tech.slashdot.org/story/09/11/05/1552204/Facebook-and-MySpace-Backdoors-Found-Fixed">very dangerous</a>.  The primary reason it&#8217;s dangerous is that a malicious application can potentially make requests on behalf of the user and access data from domains that the application didn&#8217;t originate from.  To protect against these types of attacks Flash Player and other plugins have implemented a cross-domain policy system.  This policy system is one of the most misunderstood aspects of web security.</p>
<p>To illustrate the problem I&#8217;ve create a few demos.  Let&#8217;s say that I&#8217;m building an application for www.jamesward.com that will fetch <a href="http://www.firststepsinflex.com/data.php">some data</a> from the www.firststepsinflex.com site.</p>
<p><a href="http://www.jamesward.com/demos/crossdomainDashboard/crossdomainDashboard.html" target="_blank">Here&#8217;s that application</a> on www.jamesward.com &#8211; open it in a new window.</p>
<p>The application correctly pulled the data from the <a href="http://www.firststepsinflex.com">www.firststepsinflex.com</a> site but in order to allow the request I blindly put a <a href="http://www.firststepsinflex.com/crossdomain.xml">crossdomain.xml policy file</a> on www.firststepsinflex.com that looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #00bbdd;">&lt;!DOCTYPE cross-domain-policy SYSTEM &quot;http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd&quot;&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cross-domain-policy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;site-control</span> <span style="color: #000066;">permitted-cross-domain-policies</span>=<span style="color: #ff0000;">&quot;master-only&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;allow-access-from</span> <span style="color: #000066;">domain</span>=<span style="color: #ff0000;">&quot;*&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cross-domain-policy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>What this policy file does is instruct Flash Player to allow requests from any website to get around the same-origin policy and make requests to www.firststepsinflex.com &#8211; on behalf of the user.  Sounds harmless, right?  At this point it is, as long as all of the data on www.firststepsinflex.com is publicly available data.  But let&#8217;s suppose that not all of the data should be publicly available.  Perhaps I&#8217;m protecting access to some data though cookie authentication or HTTP basic authentication.  In this case I am (for the purpose of the demo).</p>
<p>See the protected data by opening up <a href="http://www.firststepsinflex.com/private/bankaccounts.html">http://www.firststepsinflex.com/private/bankaccounts.html</a> using &#8220;username&#8221; and &#8220;password&#8221; (without quotes) for the user name and password.</p>
<p>Now imagine that someone starts posting Twitter links (obfuscated through a URL shortener) phishing for people to open a <a href="http://www.drunkonsoftware.com/crossdomainHacker/crossdomainHacker.html" target="_new">malicious application</a> (open it in a new window &#8211; I promise it doesn&#8217;t do anything bad).</p>
<p>So let&#8217;s recap&#8230;  There is a <a href="http://www.firststepsinflex.com/private/bankaccounts.html">protected resource</a> that only you should be able to see in your browser.  Other applications should NOT be able to see that data.  But a <a href="http://www.drunkonsoftware.com/crossdomainHacker/crossdomainHacker.html" target="_new">malicious application</a> was able to load that same data and do whatever it wants with it.  Scary.</p>
<p>Here&#8217;s how it works&#8230;  The malicious application requests the <a href="http://www.firststepsinflex.com/private/bankaccounts.html">protected page</a>.  It was able to make the request because you were authenticated already.  And the malicious application can now read the data contained in the page and do whatever it wants with it (probably send it back to a server somewhere).</p>
<p>OK.  Now do you understand why crossdomain.xml policy files are dangerous?  Imagine if Facebook, MySpace, or YouTube had a misconfigured policy file on their servers!  Well they have &#8211; but they&#8217;ve since been fixed.  Imagine if your bank or a corporate intranet had a misconfigured policy file.  There are some very serious ramifications to these types of attacks.</p>
<p>There are also some great uses of crossdomain policy files.  For instance, api.flickr.com has an <a href="http://api.flickr.com/crossdomain.xml">open crossdomain.xml policy file</a>.  This allows applications loaded from anywhere to access Flickr data and it&#8217;s safe because api.flickr.com doesn&#8217;t use cookies or basic auth &#8211; they use web service tokens, which are not automatically transmitted by the browser and are only known to the application that performed the authentication.</p>
<p>I often hear from Flex / Flash developers that when they run into security sandbox issues the first thing they try is to open things up with a global (i.e. &#8220;*&#8221;) policy file.  I hope this article discourages that practice.  Developers should understand why the security error is happening and consider alternatives before blindly opening up their website to the possible attacks.  One alternative is to leverage a server proxy.  A server proxy can be configured so that an application doesn&#8217;t violate the same-origin policy.  For instance, if an application on foo.com needs data from bar.com then a proxy can be configured such that requests to foo.com/bar are forwarded on the server to the bar.com site.  This helps avoid attacks because users&#8217; cookies (or basic auth tokens) will not be sent to bar.com since all requests are actually being made to the foo.com site.  But be careful not to expose intranet servers through proxies.  Here is a sample Apache config for setting up a forward proxy:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">  ProxyRemote  /bar/*  http://bar.com/
  ProxyPass /bar http://bar.com
  ProxyPassReverse /bar http://bar.com</pre></div></div>

<p><a href="http://opensource.adobe.com/blazeds">BlazeDS</a> also includes a proxy service.</p>
<p>If you really need to use a crossdomain policy file then be very careful!  NEVER put a crossdomain policy file on a site that uses cookie or basic auth and NEVER put a crossdomain policy file on an intranet site &#8211; unless you really know what you are doing.  To learn how to safely use crossdomain policy files here are some great resources:</p>
<ul>
<li><a href="http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html">Policy file changes in Flash Player 9 and Flash Player 10</a></li>
<li><a href="http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html">Cross-domain policy file specification</a></li>
</ul>
<p>I hope this helps create better understanding of web security.  Please let me know if you have any questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2009/11/08/how-bad-crossdomain-policies-expose-protected-data-to-malicious-applications/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
