<?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>ria-coder.com &#187; Flex</title>
	<atom:link href="http://ria-coder.com/blog/category/flex/feed" rel="self" type="application/rss+xml" />
	<link>http://ria-coder.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 21 Apr 2010 19:35:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WireframeSketcher Review</title>
		<link>http://ria-coder.com/blog/wireframesketcher-review</link>
		<comments>http://ria-coder.com/blog/wireframesketcher-review#comments</comments>
		<pubDate>Sun, 18 Apr 2010 13:31:01 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=587</guid>
		<description><![CDATA[I've been waiting for an Eclipse-based wireframing/mockup tool for a while now, and it's finally here :)]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been waiting for an Eclipse-based wireframing/mockup tool for a while now, and it&#8217;s finally here <img src='http://ria-coder.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  and at $75, i think it&#8217;s a reasonable price to pay for such a useful plugin, although still a little highly priced.</p>
<p><a title="WireframeSketcher" href="http://wireframesketcher.com/" target="_blank">WireframeSketcher </a>is an Eclipse plugin which offers a similar feature-set to <a title="Balsamiq Mockups" href="http://www.balsamiq.com/" target="_blank">Balsamiq Mockups</a>, although personally i prefer WireframeSketcher. Firstly, it plugs right in to my current workflow in Eclipse &#8211; that already wins it many points in my book! Aside from that, the plugin feels a lot more stable than Balsamiq and offers a few interesting features, such as:</p>
<ul>
<li>Wiki syntax formatting on all supported controls</li>
<li>Screens vs Masters vs Storyboards
<ul>
<li>A <strong>Screen </strong>is a view that you can build</li>
<li>A <strong>Master</strong> is a reusable component that can be used in <strong>Screens</strong></li>
<li>A <strong>Storyboard</strong> is made up of a collection of <strong>Screens</strong></li>
</ul>
</li>
<li>Well thought-out presentation mode allowing you to jump between screens</li>
</ul>
<p>All in all, i like the way it&#8217;s structured; i like that you can create separate files for logically separate areas of your whole application mockup and bring them together in a storyboard. I&#8217;ve used it on a couple practical examples that i was planning to do, and it feels comfortable and usable.</p>
<p>If you&#8217;re developing your a Java application with SWT, there&#8217;s also a neat plugin to export your wireframes as SWT code <img src='http://ria-coder.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Maybe an MXML export feature is on the cards too! That would certainly be wonderful&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/wireframesketcher-review/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Introducing Aerial CMS</title>
		<link>http://ria-coder.com/blog/introducing-aerial-cms</link>
		<comments>http://ria-coder.com/blog/introducing-aerial-cms#comments</comments>
		<pubDate>Sun, 11 Apr 2010 20:09:10 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Aerial CMS]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=580</guid>
		<description><![CDATA[Introduction to my latest open-source project - Aerial CMS]]></description>
			<content:encoded><![CDATA[<p>Well, I finally let my irritation get to me&#8230; I&#8217;ve been developing Flash, Flex &amp; AIR applications for two years now &#8211; most of them pulling data through AMFPHP from a PHP-based back-end. In those two years, I&#8217;ve tried nearly all the suggested solutions for managing content on the back-end and pulling it through to the front-end; <a title="Drupal" href="http://drupal.org" target="_blank">Drupal</a>, <a title="MODx" href="http://modx-cms.com" target="_blank">MODx</a>, <a title="WordPress" href="http://wordpress.org" target="_blank">WordPress</a>, <a title="Symfony" href="http://symfony-project.org" target="_blank">Symfony</a>. They are all fantastic PHP-based frameworks and systems, but they don&#8217;t allow me to develop applications the way <em>I want to</em>. So, as a consequence of this combination of irritation, frustration, egotism and flat-out boredom with writing the same code, over and over, for each project, I&#8217;ve decided to build a CMS &#8211; <strong>Aerial CMS</strong>.</p>
<p><img class="aligncenter size-full wp-image-583" title="aerial-logo" src="http://ria-coder.com/temp/wp-content/uploads/2010/04/aerial-logo.png" alt="aerial-logo" width="280" height="70" /></p>
<h2>What is Aerial CMS?</h2>
<p>Aerial CMS (named Aerial because it was the first word i could think of with <em>&#8220;RIA&#8221;</em> in it) is a <span style="text-decoration: underline;">simple content management framework</span>. I decided to rethink the concept of a content management system, because &#8211; the way I see it &#8211; CMSs these days are about content management <strong>AND</strong> content presentation. I think that these two massive areas of development &amp; design need to stay very far away from each other. They are like brother and sister to us now, but sometimes &#8211; when stuck in a room together for so long &#8211; they breed and the results are disastrous (on top of being scandalous!).</p>
<h2>Design Philosophy</h2>
<p>Look at how the MVC (<strong>M</strong>odel <strong>V</strong>iew <strong>C</strong>ontroller) pattern came about: software engineers found that <em>separating application logic from presentation from data</em> has serious design benefits. Now, i&#8217;m not attempting to bad-mouth all the incredible efforts of the CMS developers&#8230; I&#8217;m saying that for <em>Rich Internet Application</em> development, it really becomes a chore to use systems like Drupal or Symfony because they were not meant to be used in that way. They do what they do superbly well, but for RIAs they fail to impress me.</p>
<p>Aerial CMS has been built from the first line of code for <em>optimized Rich Internet Application</em> development. It focuses only on content management and development tooling, and wants <strong>nothing to do with how you present the data</strong>. It&#8217;s certainly a change from the standard model, and i&#8217;m convinced about how I want to develop my RIAs, but that&#8217;s why i&#8217;ve put out this early release &#8211; to see if you all agree with me. This CMS still has a very, very long way to go; it works well for most situations but the tools haven&#8217;t been developed yet.</p>
<h2>Technology</h2>
<p>Aerial has been built on two very well established and loved open-source frameworks, namely <strong><a title="AMFPHP" href="sourceforge.net/projects/amfphp" target="_blank">AMFPHP</a></strong> 1.9 and <strong><a title="Doctrine" href="http://doctrine-project.org" target="_blank">Doctrine</a> </strong>1.2.1. The Aerial framework is built for compatibility with <strong>PHP 5 only</strong>. Aerial enforces no rules upon you when you get down to developing your back-end code, but it does stick to Doctrine&#8217;s method of generating database tables and models. In essence, once you&#8217;ve set up your database schema, you can do whatever you like <img src='http://ria-coder.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  you can plug into Doctrine&#8217;s API or you can write your own code; it really gives you the freedom to code the way you&#8217;re comfortable with.</p>
<h2>Tutorials and Videos</h2>
<p>I&#8217;ve made a <a title="Getting Started" href="http://aerial-project.org/videos/getting-started/" target="_blank">Getting Started</a> video to get you familiar with the framework and i&#8217;ll be writing a series of tutorials in the <a title="Wiki" href="http://code.google.com/p/aerial-cms/w/list" target="_blank">Wiki section</a> of the <a title="Google Code page" href="http://code.google.com/p/aerial-cms/" target="_blank">Google Code page</a> for Aerial CMS. I&#8217;ve also got plans for a couple more video tutorials, so keep checking the site for updates or follow me on Twitter (<strong><a title="Twitter" href="http://twitter.com/dannykopping" target="_blank">@dannykopping</a></strong>).</p>
<h2>Comments, Suggestions, et al</h2>
<p>I&#8217;d love to hear what you have to say (as long as it&#8217;s in English &#8211; being monolingual sucks)! I&#8217;m very open to suggestions, any offers to help contribute would be welcomed and all constructive criticism is encouraged!</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/introducing-aerial-cms/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Dynamically controlling cross-domain permissions</title>
		<link>http://ria-coder.com/blog/dynamically-controlling-cross-domain-permissions</link>
		<comments>http://ria-coder.com/blog/dynamically-controlling-cross-domain-permissions#comments</comments>
		<pubDate>Tue, 09 Mar 2010 23:12:46 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=566</guid>
		<description><![CDATA[What are crossdomain.xml files? As any developer who has ever dipped their toes into the murky pond that is cross-domain configuration with Flash will tell you, it is quite a confusing and somewhat aggravating task to accomplish. In this post, I&#8217;m going to demonstrate how you can control access to your APIs from Flash applications]]></description>
			<content:encoded><![CDATA[<h2>What are crossdomain.xml files?</h2>
<p>As any developer who has ever dipped their toes into the murky pond that is cross-domain configuration with Flash will tell you, it is quite a confusing and somewhat aggravating task to accomplish. In this post, I&#8217;m going to demonstrate how you can control access to your APIs from Flash applications by dynamically generating crossdomain.xml files that work the same as static crossdomain.xml files.</p>
<p>But before we go any further, what the hell is a crossdomain.xml file?</p>
<p>The definition of a cross-domain configuration file is (taken from <a title="Cross-Domain" href="http://www.senocular.com/pub/adobe/crossdomain/policyfiles.html" target="_self">http://www.senocular.com/pub/adobe/crossdomain/policyfiles.html</a>):</p>
<blockquote><p>A cross-domain policy file is a XML document that grants a web client, such as Adobe Flash Player, permission to handle data across multiple domains. When a client hosts a content from a particular source domain and that content makes requests directed towards a domain other than its own, the remote domain would need to host a cross-domain policy file that would grant access to the source domain allowing the client to continue with the transaction. Policy files grant read access to data as well as permit a client to include custom headers in cross-domain requests.</p></blockquote>
<p>Essentially what this means is that if you have a Flash application and you need to pull data (other than images or video) from a domain which is not the domain of your hosted application, you will need to place a crossdomain.xml file on the server you are requesting data from.</p>
<p>The configuration file needs to be placed in the webroot of the server; you can have a look at some of the more popular sites&#8217; crossdomain.xml files:</p>
<ul>
<li><a title="YouTube" href="http://youtube.com/crossdomain.xml" target="_blank">http://youtube.com/crossdomain.xml</a></li>
<li><a title="Twitter" href="http://twitter.com/crossdomain.xml" target="_blank">http://twitter.com/crossdomain.xml</a></li>
<li><a title="Facebook" href="http://facebook.com/crossdomain.xml" target="_blank">http://facebook.com/crossdomain.xml</a></li>
</ul>
<p>This post is not a &#8220;how-to&#8221; on crossdomain.xml files unfortunately: for that, you can visit <a title="Crossdomain Help" href="http://www.adobe.com/devnet/flashplayer/articles/cross_domain_policy.html" target="_blank">http://www.adobe.com/devnet/flashplayer/articles/cross_domain_policy.html</a> &#8211; a great article by Lucas Adamski.</p>
<h2>The Problem</h2>
<p>You would like to control access to your application&#8217;s API based on a database table, for instance:</p>
<p>You have an application that serves up a list of products like Amazon.com to be made available via AMF requests (could be a REST-based architecture, SOAP, etc). You have a service offering whereby Flash/Flex application developers can register with your company to be allowed to access this wonderful API. You charge a set price per year for your service and you keep a database of authorized subscribers. At this stage, you can either allow any domain to access your API by using the following crossdomain.xml file:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE cross-domain-policy SYSTEM &quot;http://www.adobe.com/xml/dtds/cross-domain-policy.dtd&quot;&gt;</span>
&nbsp;
<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></td></tr></table></div>

<p>The problem with this configuration is that any domain can send requests to your API from their Flash applications, and for obvious reasons this is not such a great idea.</p>
<p>The other (more secure) option would be to manually stick in each subscriber&#8217;s domain name into the crossdomain.xml file as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE cross-domain-policy SYSTEM &quot;http://www.adobe.com/xml/dtds/cross-domain-policy.dtd&quot;&gt;</span>
&nbsp;
<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;example1.com&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;example2.com&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;example3.com&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></td></tr></table></div>

<p>With the above configuration, you will start running into major headaches your subscribers either start cancelling their accounts or fail to pay in full. You will manually have to go and remove their domains from the configuration each time.</p>
<h2>The Solution</h2>
<p>When Flash applies a security policy like this, it automatically looks for a crossdomain.xml file on the requested server in the webroot. We can use a nifty combination of Apache rewriting and a PHP script to dynamically generate a list of authorized domains.</p>
<h3>Apache Configuration</h3>
<p>We want Apache to listen for an incoming request for our crossdomain.xml file, but instead of serving the XML file, we want to process a PHP script called <strong>generate-config.php</strong> to generate our configuration options. This example is quite simplistic, and I encourage you to take this further with whatever rules your application may require.</p>
<p>We are going to create a <strong>.htaccess</strong> file in the webroot of our server with the following contents:</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 193px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">RewriteEngine On</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 193px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">RewriteCond %{REQUEST_URI} crossdomain.xml</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 193px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">RewriteRule ^crossdomain\.xml$ generate-config.php [L]</div>
<pre>RewriteEngine On
RewriteCond %{REQUEST_URI} crossdomain.xml
RewriteRule ^crossdomain\.xml$ generate-config.php [L]</pre>
<p>This will present the output of our <strong>generate-config.php</strong> file as the contents of the <strong>crossdomain.xml</strong> file &#8211; essentially using another file&#8217;s content in place of another.</p>
<h3>PHP &amp; MySQL</h3>
<p>In our <strong>generate-config.php</strong> file, we are going to:</p>
<ol>
<li>Connect to a database</li>
<li>Run a SQL query that will return a list of subscribers</li>
<li>Iterate through our list and add them to our XML output</li>
<li>Echo the XML output back to Apache</li>
</ol>
<p>First, create a database called <strong>crossdomain_test</strong> and then run the following SQL query to create our <em>subscribers</em> table:</p>
<pre>CREATE TABLE IF NOT EXISTS `subscribers` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `domain` varchar(255) NOT NULL,
  `active` tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</pre>
<p>Insert a couple of test rows:</p>
<pre>INSERT INTO `subscribers` (`ID`, `name`, `domain`, `active`) VALUES
(1, 'YouTube', 'youtube.com', 1),
(2, 'Twitter', 'twitter.com', 1);</pre>
<p>Now we&#8217;re going to create our <strong>generate-config.php</strong> file in the webroot:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #666666; font-style: italic;">// create our config skeleton according to the crossdomain.xml rules</span>
	<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!DOCTYPE cross-domain-policy SYSTEM &quot;http://www.adobe.com/xml/dtds/cross-domain-policy.dtd&quot;&gt;
&lt;cross-domain-policy&gt;
	&lt;site-control permitted-cross-domain-policies=&quot;master-only&quot;/&gt;
&lt;/cross-domain-policy&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// create $config variable to hold our config data</span>
	<span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SimpleXMLElement<span style="color: #009900;">&#40;</span><span style="color: #000088;">$xml</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// connect to MySQL and select database</span>
	<span style="color: #000088;">$conn</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;username&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;password&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;crossdomain_test&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$conn</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// loop through all rows, and create xml nodes</span>
	<span style="color: #000088;">$res</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT domain FROM subscribers WHERE active = 1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$subscriber</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_object</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$child</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addChild</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;allow-access-from&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$child</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;domain&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$subscriber</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">domain</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// echo back to Apache</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">asXML</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>If we navigate to the <strong>crossdomain.xml</strong> file in the browser, we should see:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td 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.adobe.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;youtube.com&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;twitter.com&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></td></tr></table></div>

<p>and if we delete one of the records out of the table (try deleting YouTube), and navigate to that page again, you&#8217;ll see:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td 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.adobe.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;twitter.com&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></td></tr></table></div>

<p>And that&#8217;s it! Not too difficult at all <img src='http://ria-coder.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>A Workaround for all frustrated developers consuming REST services</h2>
<p>As a side-note, if you ever encounter a site that you need to pull data from and they do not have a crossdomain.xml file, all you have to do is write a simple &#8220;proxy&#8221; file with PHP (or whichever language you choose) that will accept one parameter (the URL to be called) and send the results back:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
	<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;url&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Make sure that this proxy file is sitting in your domain though, or a domain with a crossdomain.xml file present.</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/dynamically-controlling-cross-domain-permissions/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Accessing services-config.xml values from Flex at runtime</title>
		<link>http://ria-coder.com/blog/accessing-services-config-values-with-flex</link>
		<comments>http://ria-coder.com/blog/accessing-services-config-values-with-flex#comments</comments>
		<pubDate>Thu, 11 Feb 2010 19:24:58 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[serverconfig]]></category>
		<category><![CDATA[services-config]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=545</guid>
		<description><![CDATA[Recently I found this magic class in the Flex 3 SDK called ServerConfig.]]></description>
			<content:encoded><![CDATA[<p>Recently I found this magic class in the Flex 3 SDK called <a title="ServerConfig" href="http://www.adobe.com/livedocs/flex/3/langref/mx/messaging/config/ServerConfig.html" target="_blank">ServerConfig</a>. This class is great&#8230; What it allows you to do is access values that you defined in your <em>services-config.xml</em> file used to define the communication channels between Flex and your server.</p>
<p>Take the following <em>services-config.xml</em> file for example:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td 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: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;services-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;services<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;amfphp-flashremoting-service&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;flex.messaging.services.RemotingService&quot;</span></span>
<span style="color: #009900;">				<span style="color: #000066;">messageTypes</span>=<span style="color: #ff0000;">&quot;flex.messaging.messages.RemotingMessage&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;destination</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;amfphp&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;channels<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;channel</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;my-amfphp&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/channels<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/source<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/destination<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/services<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;channels<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;channel-definition</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;my-amfphp&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;mx.messaging.channels.AMFChannel&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;endpoint</span> <span style="color: #000066;">uri</span>=<span style="color: #ff0000;">&quot;gateway.php&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;flex.messaging.endpoints.AMFEndpoint&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/channel-definition<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/channels<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/services-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>As you can see, we&#8217;re setting the endpoint for our <em>my-amfphp</em> channel to <strong>gateway.php</strong>. What if you wanted to read that value into your Flex application? You could use the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>ServerConfig<span style="color: #000066; font-weight: bold;">.</span>getChannel<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;my-amfphp&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>endpoint<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>Check out the <a title="ServerConfig" href="http://www.adobe.com/livedocs/flex/3/langref/mx/messaging/config/ServerConfig.html" target="_blank">ServerConfig</a> for more information!</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/accessing-services-config-values-with-flex/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>AMFPHP is back!</title>
		<link>http://ria-coder.com/blog/amfphp-is-back</link>
		<comments>http://ria-coder.com/blog/amfphp-is-back#comments</comments>
		<pubDate>Tue, 02 Feb 2010 13:29:49 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[amfphp]]></category>
		<category><![CDATA[amfphp 1.9]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=541</guid>
		<description><![CDATA[AMFPHP is back!]]></description>
			<content:encoded><![CDATA[<p>Today is a wonderful day!</p>
<p>I have teamed up with <a title="Ariel Sommeria" href="http://arielsommeria.com/blog/" target="_blank">Ariel Sommeria-klein</a> to revive the legendary <a title="AMFPHP" href="http://amfphp.sourceforge.net" target="_blank">AMFPHP</a> project that spawned a whole new dimension of Rich Internet Applications. Together we have brought <a title="AMFPHP 1.9" href="https://sourceforge.net/projects/amfphp/files/#files" target="_blank">AMFPHP 1.9</a> out of beta and made it compatible with PHP 5.3. We have also completely rewritten the AMFPHP service browser and we have several improvements planned for AMFPHP 2.0.</p>
<p>If you would like to help contribute to this great open-source application, please <a title="Contact Us!" href="http://amfphp.sourceforge.net/contact.html" target="_blank">contact us</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/amfphp-is-back/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Truly Cached Flex Modules</title>
		<link>http://ria-coder.com/blog/truly-cached-flex-modules</link>
		<comments>http://ria-coder.com/blog/truly-cached-flex-modules#comments</comments>
		<pubDate>Sun, 31 Jan 2010 19:56:14 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[modules]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=532</guid>
		<description><![CDATA[I was working on a project recently and I discovered (or possibly misunderstood - see disclaimer) that Flex does not cache modules correctly, or - at the very least - it does not do it effectively according to my tests.]]></description>
			<content:encoded><![CDATA[<p>I was working on a project recently and I discovered (or possibly misunderstood &#8211; see disclaimer) that Flex does <strong>not</strong> cache modules correctly, or &#8211; at the very least &#8211; it does not do it effectively according to my tests.</p>
<p><em>My test was conducted using Flex SDK <strong>3.4.0.9271, </strong>Firefox <strong>3.5.7 </strong>and <strong>Flex Builder Professional 3.0.214193</strong></em></p>
<p>According to <a title="Adobe LiveDocs" href="http://livedocs.adobe.com/flex/3/html/help.html?content=modular_5.html" target="_blank">this</a> page (under the <strong>Preloading modules</strong> heading), Adobe asserts the following:</p>
<blockquote><p>When a module is loaded by the Flex application for the first time, the module&#8217;s SWF file is transferred across the network and stored in the browser&#8217;s cache. If the Flex application unloads that module, but then later reloads it, there should be less wait time because Flash Player loads the module from the cache rather than across the network.</p>
<p>Module SWF files, like all SWF files, reside in the browser&#8217;s cache unless and until a user clears them. As a result, modules can be loaded by the main application across several sessions, reducing load time; but this depends on how frequently the browser&#8217;s cache is flushed.</p></blockquote>
<p>I found the above claims to be demonstrably false, or at least just plain inefficient&#8230;</p>
<p>Let me qualify this:<br />
According to my tests (conducted with my Firefox browser cache turned both on and off), i found that the application&#8217;s memory usage keeps growing exponentially when switching between two loaded modules. There was a variance (as you&#8217;d imagine) when the browser cache was left on but nonetheless, the memory usage keeps growing steadily.</p>
<p>In the code sample below, I have extended the functionality of the <strong>mx.modules.ModuleLoader</strong> class, and added a Dictionary (with a little logic) to manage the (ostensibly) effective caching of previously loaded modules. I have not tested this class extensively, but all the tests that I conducted seemed to produce a significant memory and speed improvement.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">DisplayObject</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">DisplayObjectContainer</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ByteArray</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Dictionary</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.</span>FlexEvent<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.</span>ModuleEvent<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>modules<span style="color: #000066; font-weight: bold;">.</span>IModuleInfo<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>modules<span style="color: #000066; font-weight: bold;">.</span>ModuleLoader<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>modules<span style="color: #000066; font-weight: bold;">.</span>ModuleManager<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * This class manages the loading, unloading and caching of Flex Modules
	 * This is a modified version of the mx.modules.ModuleLoader class
	 *
	 * @author Danny Kopping - danny@ria-coder.com
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> CachedModuleLoader <span style="color: #0033ff; font-weight: bold;">extends</span> ModuleLoader
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">map</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Dictionary</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Dictionary</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _url<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> module<span style="color: #000066; font-weight: bold;">:</span>IModuleInfo<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> loadRequested<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CachedModuleLoader<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> <span style="color: #004993;">url</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span> == _url<span style="color: #000000;">&#41;</span>
				<span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>module<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">PROGRESS</span><span style="color: #000066; font-weight: bold;">,</span> moduleProgressHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span>SETUP<span style="color: #000066; font-weight: bold;">,</span> moduleSetupHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span>READY<span style="color: #000066; font-weight: bold;">,</span> moduleReadyHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ERROR</span><span style="color: #000066; font-weight: bold;">,</span> moduleErrorHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">UNLOAD</span><span style="color: #000066; font-weight: bold;">,</span> moduleUnloadHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #009900; font-style: italic;">//module.release();</span>
				module = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">child</span><span style="color: #000000;">&#41;</span>
				<span style="color: #000000;">&#123;</span>
					<span style="color: #004993;">removeChild</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">child</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
					<span style="color: #009900; font-style: italic;">//child = null;</span>
				<span style="color: #000000;">&#125;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			_url = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> FlexEvent<span style="color: #000000;">&#40;</span>FlexEvent<span style="color: #000066; font-weight: bold;">.</span>URL_CHANGED<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			removeAllChildren<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_url <span style="color: #000066; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> loadRequested<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span><span style="color: #004993;">map</span><span style="color: #000000;">&#91;</span>_url<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
					loadModule<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">else</span>
				<span style="color: #000000;">&#123;</span>
&nbsp;
					<span style="color: #004993;">child</span> = <span style="color: #004993;">map</span><span style="color: #000000;">&#91;</span>_url<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span>
					<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">child</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #000000;">&#125;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> <span style="color: #004993;">url</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> _url<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> createComponentsFromDescriptors<span style="color: #000000;">&#40;</span>recurse<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000066; font-weight: bold;">.</span>createComponentsFromDescriptors<span style="color: #000000;">&#40;</span>recurse<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			loadRequested = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
			loadModule<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> loadModule<span style="color: #000000;">&#40;</span><span style="color: #004993;">url</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> bytes<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">ByteArray</span> = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">url</span> <span style="color: #000066; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span>
				_url = <span style="color: #004993;">url</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_url == <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #009900; font-style: italic;">//trace(&quot;loadModule() - null url&quot;);</span>
				<span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">map</span><span style="color: #000000;">&#91;</span>_url<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #009900; font-style: italic;">//trace(&quot;loadModule() - already created the child&quot;);</span>
				<span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>module<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #009900; font-style: italic;">//trace(&quot;loadModule() - load already initiated&quot;);</span>
				<span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> FlexEvent<span style="color: #000000;">&#40;</span>FlexEvent<span style="color: #000066; font-weight: bold;">.</span>LOADING<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			module = ModuleManager<span style="color: #000066; font-weight: bold;">.</span>getModule<span style="color: #000000;">&#40;</span>_url<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">PROGRESS</span><span style="color: #000066; font-weight: bold;">,</span> moduleProgressHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span>SETUP<span style="color: #000066; font-weight: bold;">,</span> moduleSetupHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span>READY<span style="color: #000066; font-weight: bold;">,</span> moduleReadyHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ERROR</span><span style="color: #000066; font-weight: bold;">,</span> moduleErrorHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">UNLOAD</span><span style="color: #000066; font-weight: bold;">,</span> moduleUnloadHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">applicationDomain</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> bytes<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> unloadModule<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">child</span> <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> <span style="color: #004993;">contains</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">child</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #004993;">removeChild</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">child</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #004993;">child</span> = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>module<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">PROGRESS</span><span style="color: #000066; font-weight: bold;">,</span> moduleProgressHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span>SETUP<span style="color: #000066; font-weight: bold;">,</span> moduleSetupHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span>READY<span style="color: #000066; font-weight: bold;">,</span> moduleReadyHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ERROR</span><span style="color: #000066; font-weight: bold;">,</span> moduleErrorHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">unload</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				module<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span>ModuleEvent<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">UNLOAD</span><span style="color: #000066; font-weight: bold;">,</span> moduleUnloadHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				module = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">map</span><span style="color: #000000;">&#91;</span>_url<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">delete</span> <span style="color: #004993;">map</span><span style="color: #000000;">&#91;</span>_url<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> moduleProgressHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>ModuleEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span>event<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> moduleSetupHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>ModuleEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #009900; font-style: italic;">// Not ready for creation yet, but can call factory.info().</span>
&nbsp;
			<span style="color: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span>event<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> moduleReadyHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>ModuleEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">child</span> = module<span style="color: #000066; font-weight: bold;">.</span>factory<span style="color: #000066; font-weight: bold;">.</span>create<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">DisplayObject</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span>event<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">child</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> p<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">DisplayObjectContainer</span> = <span style="color: #004993;">parent</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #009900; font-style: italic;">// p.removeChild(this);</span>
				<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">child</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #004993;">map</span><span style="color: #000000;">&#91;</span><span style="color: #004993;">url</span><span style="color: #000000;">&#93;</span> = <span style="color: #004993;">child</span><span style="color: #000066; font-weight: bold;">;</span><span style="color: #009900; font-style: italic;">//ModuleManager.getModule(_url);</span>
				<span style="color: #009900; font-style: italic;">//trace(map + &quot;:&quot; + url + &quot;:&quot; + map[url]);</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> moduleErrorHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>ModuleEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			unloadModule<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span>event<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> moduleUnloadHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>ModuleEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span>event<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>The usage of this class is exactly the same as the regular <strong>mx.modules.ModuleLoader</strong> class. I hope this helps!</p>
<p><strong>Download this file:</strong> <a href="http://ria-coder.com/blog/wp-content/uploads/2010/01/CachedModuleLoader.as">Download</a></p>
<p><strong>**DISCLAIMER**<br />
<span style="font-weight: normal; ">I know a bit about Flex modules from hours of obsessing over them, but i <span style="text-decoration: underline;">do not know everything</span>. From my tests of the efficacy of the above code &amp; explanation, i found that it reduces memory usage and increases the general usability of my Flex project; i could be very wrong on this topic, and if i am &#8211; please tell me. Maybe i&#8217;m just an idiot, but it seems to work&#8230;</span></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/truly-cached-flex-modules/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using a Custom Cursor in Flex with CSS</title>
		<link>http://ria-coder.com/blog/using-a-custom-cursor-in-flex-with-css</link>
		<comments>http://ria-coder.com/blog/using-a-custom-cursor-in-flex-with-css#comments</comments>
		<pubDate>Wed, 16 Dec 2009 21:54:22 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[cursor]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[stylesheet]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=511</guid>
		<description><![CDATA[Learn how to define a custom Flex busy cursor in pure CSS]]></description>
			<content:encoded><![CDATA[<p>If you want to use a custom <em>busyCursor</em> animation in your Flex applications, you don&#8217;t need to do anything fancy&#8230; All you have to do is define one, solitary property in your CSS file:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">CursorManager
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #808080; font-style: italic;">/* You can use PNGs, SWFs or JPEGs */</span>
	busyCursor<span style="color: #00AA00;">:</span> Embed<span style="color: #00AA00;">&#40;</span>source<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;path/to/your/resource&quot;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>
To invoke the busy cursor, use the following line:<br />
</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">CursorManager.<span style="color: #006600;">setBusyCursor</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>&#8230;or you could set the <em>showBusyCursor</em> to <strong>true</strong> in your HTTPService or RemoteObject instances.</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/using-a-custom-cursor-in-flex-with-css/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AMFPHP Genie v0.2</title>
		<link>http://ria-coder.com/blog/amfphp-genie-02</link>
		<comments>http://ria-coder.com/blog/amfphp-genie-02#comments</comments>
		<pubDate>Sun, 13 Dec 2009 23:35:56 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[amfphp]]></category>
		<category><![CDATA[amfphp genie]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=505</guid>
		<description><![CDATA[AMFPHP Genie (0.2) is a simple tool to help you get shit done using Flex and AMFPHP.]]></description>
			<content:encoded><![CDATA[<p>AMFPHP Genie (0.2) is a simple tool to help you get shit done using Flex and AMFPHP.</p>
<p>Check out <a title="AMFPHP Genie" href="http://dannykopping.co.za/amfphp-genie/">http://dannykopping.co.za/amfphp-genie/</a> for more information!</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/amfphp-genie-02/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>QuickTip: asSQL Connection Problem with non-localhost hostname</title>
		<link>http://ria-coder.com/blog/assql-connection-problem-with-non-localhost-hostname</link>
		<comments>http://ria-coder.com/blog/assql-connection-problem-with-non-localhost-hostname#comments</comments>
		<pubDate>Sat, 12 Dec 2009 22:58:26 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[assql]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=488</guid>
		<description><![CDATA[Read this post to fix that annoying error with asSQL when trying to connect to remote MySQL installations]]></description>
			<content:encoded><![CDATA[<p><a title="asSQL" href="http://code.google.com/p/assql/">asSQL</a> is just great. It&#8217;s an ActionScript 3.0 library  for connecting AIR applications to MySQL databases and it works brilliantly &#8211; when it works! Recently i gave it a shot again after an utter failure the last time i tried it&#8230; The library seems to be a port of the Java implementation of connecting to MySQL (<em>Connections, Statements, Fields, etc</em>). It takes a little getting used to but it&#8217;s an excellent library and i highly recommend it.<br />
<br />
<h2>Background</h2>
<p>My development environment is Windows-based (against my wishes&#8230; not enough loot or motivation for a Mac, lack of Adobe software on Linux) but i make up for this by running a virtual Linux installation in my Windows environment and networking the two together. It actually works really well, and the process for setting this up can be found <a title="Ubuntu + Windows" href="http://www.simonholywell.com/computing/internet/a-good-windows-development-environment-and-ubuntu-virtualbox.html">here</a>. To cut a very long and boring story short, essentially i cannot use <em>localhost</em> as your server when using this architecture since i have my LAMPP stack running on my Linux environment, so my &#8220;local server&#8221; can only be accessed using the IP address of the virtual system.</p>
<p>This complicates things a bit when trying to use asSQL to connect to my MySQL installation, because MySQL gets all paranoid and won&#8217;t accept connections from a foreign IP address (the IP of my Windows machine on which my AIR app is running)&#8230; To get around this, all you have to do is create a new user in MySQL (i used <a title="phpMyAdmin" href="http://phpmyadmin.net">phpMyAdmin</a>), set the user&#8217;s hostname to the IP address of your remote system (i&#8217;ve explained how to do this below) and you&#8217;re ready to rock and roll!<br />
<br />
<h2>Solution</h2>
<p>The first thing you need to do is get the IP address of the remote system&#8230;</p>
<p><strong>Windows: </strong>Open the command line, type <em>ipconfig<br />
<strong><span style="font-style: normal;">Linux</span><span style="font-weight: normal;"> </span><span style="font-style: normal;">&amp; Mac: <span style="font-weight: normal;">Open the terminal, type <em>ifconfig</em></span></span></strong></em></p>
<p><strong><span style="font-weight: normal;">In this example, my IP address is </span>192.168.56.1</strong></p>
<p>I&#8217;ll be using phpMyAdmin to fix the problem.</p>
<ol>
<li>Open phpMyAdmin and click on the <strong>Privileges</strong> tab.</li>
<li>Click <strong>Add a new User</strong></li>
<li>Enter any username you like, paste the IP address obtained in the <strong>Host</strong> field and put in a password</li>
<li>Under the <em>Database for user</em> panel, leave it at <strong>None</strong></li>
<li>Under the <em>Global privileges</em>, you can <strong>Check All</strong></li>
</ol>
<p>That should sort it out&#8230; Remember, this is <strong>HIGHLY</strong> insecure and should <strong>only be used on development environments and <span style="text-decoration: underline;">NOT</span> production environments.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/assql-connection-problem-with-non-localhost-hostname/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fixing that annoying feature of List controls</title>
		<link>http://ria-coder.com/blog/fixing-that-annoying-feature-of-list-controls</link>
		<comments>http://ria-coder.com/blog/fixing-that-annoying-feature-of-list-controls#comments</comments>
		<pubDate>Sun, 15 Nov 2009 21:57:07 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[creationPolicy]]></category>
		<category><![CDATA[offscreen]]></category>
		<category><![CDATA[tilelist]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=469</guid>
		<description><![CDATA[Learn how to fix that ever-painful "optimization" feature of Flex's list components]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t you just hate it&#8230; Doesn&#8217;t it just piss you off when you want to display a gallery of images in Flex and Flex decides that it&#8217;s actually going to set it so that when you scroll, it&#8217;ll <em>only</em> <em>then</em> load the images displayed offscreen? I find this particularly &#8220;ball-ache-ish&#8221; with the TileList component.</p>
<p>I was browsing through the documentation like i had many times before, but this time i noticed the <strong>offscreenExtraRowsOrColumns</strong> property. At first you think &#8220;wtf&#8221; but then i got curious&#8230;</p>
<p>Say you have 25 images in a grid that displays one row of 5 images at a time:</p>
<table border="0" width="200">
<tbody>
<tr style="background-color:#C7E811">
<td height="10px"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr style="background-color:#DDDDDD">
<td height="10px"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr style="background-color:#DDDDDD">
<td height="10px"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr style="background-color:#DDDDDD">
<td height="10px"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr style="background-color:#DDDDDD">
<td height="10px"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>The row in green will be the only row visible at this point in time. When you scroll, Flex will chuck out the first row and create the second row:</p>
<table border="0" width="200">
<tbody>
<tr style="background-color:#DDDDDD">
<td height="10px"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr style="background-color:#C7E811">
<td height="10px"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr style="background-color:#DDDDDD">
<td height="10px"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr style="background-color:#DDDDDD">
<td height="10px"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr style="background-color:#DDDDDD">
<td height="10px"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>&#8230;and so on. Isn&#8217;t that just damn irritating? (If you&#8217;re thinking &#8220;nah, what&#8217;s the big deal?&#8221; then you obviously haven&#8217;t tried this before).</p>
<p>Anyway, the way to fix it is to tell Flex how many rows there are offscreen so that it can create them in the interim. This seems like a bit of a weird method because in the navigator classes (ViewStack, et al) there is a <strong>creationPolicy</strong> property which &#8211; when set to &#8220;all&#8221; &#8211; will create all the non-visible components before they&#8217;re navigated to, thus slowing down the processing a bit (depending on your app) but also speeding up the switch between views. Alas, no such property to be found in the TileList component. Can anybody tell me why? I think i should code a modified version of the TileList component to accept this property&#8230; <em>+1 to TODO list&#8230; *sigh*</em></p>
<p>Hopefully this will help those of you experiencing the ball-ache that i did.</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/fixing-that-annoying-feature-of-list-controls/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

