<?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>GridLinked to RUX &#187; Featured Articles</title>
	<atom:link href="http://www.gridlinked.info/Flex/featured-articles/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gridlinked.info</link>
	<description>Patterns with Flex, RUX, and software</description>
	<lastBuildDate>Fri, 26 Feb 2010 22:18:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>RSA Encryption for Flex 4 RSLs</title>
		<link>http://www.gridlinked.info/how-to-encrypt-flex-rsls/</link>
		<comments>http://www.gridlinked.info/how-to-encrypt-flex-rsls/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 20:27:43 +0000</pubDate>
		<dc:creator>thomasb</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[event dispatching]]></category>
		<category><![CDATA[Nitro-LM]]></category>
		<category><![CDATA[Preloader]]></category>
		<category><![CDATA[RSA Encryption]]></category>
		<category><![CDATA[RSL]]></category>
		<category><![CDATA[SystemManager]]></category>

		<guid isPermaLink="false">http://www.gridlinked.info/?p=394</guid>
		<description><![CDATA[Do you know how ridiculously easy it is to reverse-engineer/decompile a Flex 3 or Flex 4 application and its AVM byte code?  If you are developing an online Flex product, then you had better worry about protecting your source code.  I present an attractive solution for source-code protection of your intellectual property using Nitro-LM and "encryption of Flex RSLs". SimplifiedLogic's Nitro-LM already provides solutions and samples for encrypting your Flex application or encrypting a Flex "module", but nothing is available for encrypting a Flex RSL (aka shared library). So I created that solution, released it as open-source to SimplifiedLogic, and now present it to all readers. <br /><div><img src="http://www.gridlinked.info/wp-content/plugins/gd-star-rating/gfx.php?value=10.0" /></div><div>Rating: 10.0/<strong>10</strong> (5 votes cast)</div><br />]]></description>
			<content:encoded><![CDATA[<p>I have been working on a new <strong><em>ThunderBay SaaS </em></strong> product for months now. And two of the myriad issues I have had to consider is that of <span style="color: #0070C0;">user management and licensing</span> and <span style="color: #0070C0;">intellectual property protection</span> (IPP). Now many people will argue that one should not protect source code as IP, but rather business processes as IP. When it comes to online Flex products, however, I could not disagree more!</p>
<p>Do you know how ridiculously easy it is to reverse-engineer/decompile a Flex 3 application and its AVM byte code? <br/><br/>Try it: simply use <span style="text-decoration: underline;"><a href="http://www.sothink.com">SWFDecompiler</a></span> to open any SWF. Even if that .swf file has been optimized for production release, you can still see the classes, methods, and logic. If you are developing an online Flex solution, then you had better worry about protecting your source code. Why lose your invest of time and effort and let competitors steal your ideas and solutions? Patents and trademarks are not the issue here. Those are ex post facto protection mechanisms. At the very least, using source-code IPP will present an immediate &#8220;barrier-to-entry&#8221; to your competitors. </p>
<p>Now, do not misunderstand the intent of this blog. I am a huge proponent of mentoring, open-source, and the community-driven evolution of software. Google and blog entries have been radical saviors to many technical roadblocks and bugs that I have encountered. In return, I reciprocate by blogging solutions and contributing to open-source (Cairngorm Extensions/CGX, Mate Localizations, Flex Behaviour Injection, etc.) I do not, however, open source ALL my software or solutions. <br/></p>
<div id="pullquote-con">Do you deserve to be <span style="color: #990000;">bitch slapped</span>? </div>
<p>As a consultant or developer working on a disruptive solution you would be have to be an <span style="text-decoration: underline;">idiot</span> to not protect your core IP and your core source. </p>
<div class="img aligncenter" style="width:301px;">
	<a rel="lightbox;height=525;width=670" href="http://www.youtube.com/watch?v=3BRw_ihZRJI#t=0m20s"><img src="/images/2009/11/developerSlap.jpg" alt="Consequences of Not Encrypting" width="301" height="204" /></a>
	<div>Figure 1: Consequences... if you do not protect!!</div>
</div>
<p>So how do you protect your source code? Really only two (2) viable solutions exist for Flash/Flex solutions: <span style="color: #0070C0">code obfuscation</span> or <span style="color: #0070C0">encryption</span>. Source or byte code obfuscation works well for some purposes; but may present real problems with non-trivial Flex architectures. Encryption, however, is more secure and also provides opportunities for you to track customer usage and authorize access.</p>
<p>You can &quot;grow-your-own&quot; encryption mechanism and embed the decryption key in your code. Or you can use a client-cloud model to request your decryption key from a cloud-based service. <span style="text-decoration: underline;"><a href="http://www.simplifiedlogic.com" target="_blank">Nitro-LM</a></span> is a hosted, commercial technology platform that provides user management, product licenses, and software protection (encryption) for Java, .NET, Adobe Flex/AIR, C/C++ software. Nitro-LM administration, user authorization, and key creation/access is all managed online as a hosted software-as-a-service (SaaS). And while the license services are offered as an annual subscription, the yearly cost to provide RSA encryption for my software product IPP is trivial. Granted, if you have a free product, then a subscription-based licensing model may not work for you. If you have a free product, I would contend that you probably do not have a viable revenue model in the first place&#8230; so why protect it?</p>
<div id="pullquote-con">You say: &#8220;I can implement <span style="color: #990000;">my own</span> encryption scheme!&#8221; </div>
<p>Anyone who has ever tried to write user management or user license modules recalls that those features and the associated issues of maintenance &amp; availability quickly become a &quot;full-time job&quot;. The broad suite of features and functionality offered by Nitro-LM is amazing and the support is excellent (shout out to Andrew Westberg). So sign-up for a webinar and check it out for yourself; and no I do NOT get any compensation for my promotion.<br />
<br/> For the purpose of this blog, I will be presenting a solution for IP source-code protection using Nitro-LM and &quot;<u>encryption of Flex RSLs</u>&quot;. Nitro-LM already publishes solutions for encrypting your Flex application or a Flex &quot;module&quot;. But nothing was available for encrypting a Flex RSL (aka shared library). So I created that solution, released it as open-source to SimplifiedLogic, and now present it to you. Shown below is a live demo of a Flex app using a custom preloader [display] and dynamic RSL decryption:</p>
<div class="img aligncenter" style="width:311px;">
	<a rel="lightbox;height=402;width=554" href="http://www.gridlinked.info/flash/encryptedRSLs/Demo_3_LoadEncryptedRSL.html"><img src="/images/2009/11/launchDemo3.jpg" alt="Custom Preloader with Dynamic RSL Decryption" width="311" height="178" /></a>
	<div>Figure 2: Custom Preloader with Dynamic RSL Decryption (click to launch)</div>
</div>
<p><br/></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
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application layout=<span style="color: #990000;">&quot;absolute&quot;</span> 
				minWidth=<span style="color: #990000;">&quot;1024&quot;</span> minHeight=<span style="color: #990000;">&quot;768&quot;</span> 
				<span style="color: #004993;">backgroundColor</span>=<span style="color: #990000;">&quot;#777777&quot;</span>  backgroundGradientColors=<span style="color: #990000;">&quot;[#777777,#BABABA]&quot;</span>
<span style="display:block;background-color: #ffc;">				preloader=<span style="color: #990000;">&quot;tb.preloader.ThunderPreloader&quot;</span></span>				creationComplete=<span style="color: #990000;">&quot;onAppReady();&quot;</span>
				xmlns<span style="color: #000000; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> 
				xmlns<span style="color: #000000; font-weight: bold;">:</span>adobe=<span style="color: #990000;">&quot;http://www.adobe.com/2006/cairngorm&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">&lt;!--</span>
	Note the ThunderBay loading indicator <span style="color: #0033ff; font-weight: bold;">is</span> shown because
    of the preloader reference to ThunderPreloader; which <span style="color: #0033ff; font-weight: bold;">is</span> NOT
    a preloader but a subclass of DownloadProgressBar
 <span style="color: #000000; font-weight: bold;">--&gt;</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
		<span style="color: #0033ff; font-weight: bold;">import</span> mx.controls.Alert;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">import</span> tb.utils.DelayedCall;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onAppReady<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			DelayedCall.schedule<span style="color: #000000;">&#40;</span> showStatus,<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span>,<span style="color: #000000; font-weight:bold;">600</span><span style="color: #000000;">&#41;</span>;
&nbsp;
			<span style="color: #339966; font-weight: bold;">function</span> showStatus<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> msg <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">String</span> = <span style="color: #990000;">'Finished: CGX encrypted RSL was decrypted &amp; loaded using Nitro-LM!'</span>;
				mx.controls.Alert.<span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span>msg,<span style="color: #990000;">'Encrypted RSLs Loaded'</span><span style="color: #000000;">&#41;</span>;	
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
 <span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">&lt;!--</span> A <span style="color: #9900cc; font-weight: bold;">class</span> from the encrypted RSL CairngormExtensions.swf <span style="color: #000000; font-weight: bold;">--&gt;</span>
 <span style="color: #000000; font-weight: bold;">&lt;</span>adobe<span style="color: #000000; font-weight: bold;">:</span>FrontController id=<span style="color: #990000;">&quot;myController&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application<span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>This demo loads an encrytped CaignormExtension RSL. Download this <a href="http://www.gridlinked.info/flash/encryptedRSLs/CairngormExtensions.swf" target="_blank">encrypted RSL</a> directly and try to decompile it! Now download and decompile the <a href="http://www.gridlinked.info/flash/encryptedRSLs/CairngormExtensions_notEncrypted.swf"  target="_blank">standard version</a> that is NOT encrypted. The latter version you can get access to class code and logic. The former is completely locked and unreadable. I love this feature; encryption is awesome! </p>
<p><div id="pullquote-con">Why should I use RSLs with my Flex/AIR application?</div>
</p>
<p>Flex RSLs act as shared libraries (similar to DLLs on Windows), require only a single download [to the browser/flashplayer] and can be shared among multiple Flex applications. These RSLs can be optimized for small footprint sizes to achieve faster download times. And best of all, you can update an RSL with patches, upgrades, etc&#8230; without requiring new downloads of any other RSLs. This power comes with a small price to start-up time and complexities to builds and source-code organization. For a SaaS solutions, especially, I think RSLs are critical requirements. For deeper learning, check out</p>
<ol>
<li>Adobe LiveDocs &quot;<a href="http://livedocs.adobe.com/flex/3/html/help.html?content=rsl_01.html">Introduction to RSLs</a>&quot;</li>
<li>Adobe Labs     &quot;<a href="http://labs.adobe.com/wiki/index.php/Flex_3:Feature_Introductions:Flex_3_RSLs#Introduction">Flex 3 RSLs</a>&quot;
  </li>
</ol>
<p></p>
<div id="pullquote-con">You need to know <span style="color: #990000;">how RSLs are loaded</span>. </div>
</p>
<p>To understand the process of RSL encryption/decryption, you must first be familiar with how RSLs are loaded. First, do you need to know an interesting secret about a Flex application! <strong><em> A Flex application is constructed as a 2-frame movie.</em></strong> The first frame of a Flex application movie contains on the very critical classes including the SystemManager, the Preloader, the DownloadProgressBar and some glue helper classes. The second frame of a Flex SWF contains the rest of the Flex framework code, your application code and all of your application assets like embedded fonts, images, etc. This means it takes a lot longer to get all of the frame 2 downloaded than the small stuff in frame 1.</p>
<p><div id="pullquote-con">The .swf format is a <span style="color: #990000;">progressive download format</span>&#8230; </div>
<p>Which means that the Flash player can access content on downloaded frames without having to wait for subsequent frames/the entire file to download. By creating a 2-frame movie, Flex applications can take advantage of the streaming support built into the Flash Player and a preloader can appear before all of the Flex framework code and your application code are downloaded. The visible benefit of this whole idea is the loading bar. Even on a large app, Flex quickly shows that it is loading (Frame1 downloaded) and gives continual feedback to the user while the rest of the app downloads (Frame 2).
</p>
<p>So here are the steps involved in the startup of a Flex application:</p>
<ol>
<li>First, enough bytes for frame 1 are streamed down to the Flash Player.</li>
<li>The Flash Player executes those bytes by creating a SystemManager instance.</li>
<li>SystemManager instruct the Flash Player to stop at the end of frame 1.</li>
<li>SystemManager then goes on to create the Preloader which creates the DownloadProgressBar control and pops that up on the client screen.</li>
<li>The Preloader then starts tracking the rest of the bytes streaming in from the Flex SWF (or from external SWFs).<br />
  Once all the bytes for the Flex framework and application code are in, the System Manager goes on to frame 2 and instantiates the Application instance.</p>
<ul>
<li>All RSLs and their associated classes are now loaded [into the ApplicationDomain]; note that the load order is in the order defined during app compile time.</li>
<li>All class definitions used by the application (views, logic, etc) must be loaded prior to Frame 2. It is here, in Frame1, that your preloader code can even install patches to the Flex framework BEFORE the framework classes themselves are loaded. </li>
<li>This technique is called &quot;<span style="color: #0070C0;">monkey-patching</span>&quot; and will be used later <br />
        when we are discussing the decryption process.</li>
</ul>
</li>
<li>Once the Application instance has been created, the SystemManager sets Application.systemManager to itself. This is how you, the application developer, can access the SystemManager at a later time.
  </li>
<li>The Application dispatches the preinitialize event at the beginning of the initialization process.</li>
<li>Application goes on to create its children. The method createChildren() is called on the application. At this point each of the application’s components is being constructed, and each component’s createChildren() will be also called. For detail, look at component lifecycle section.</li>
<li>The Application dispatches the initialize event, which indicates that all application’s components have been initialized. However, at this state, all the components are not yet laid out.</li>
<li>Eventually, once all the Application child controls and containers have been created, sized and positioned, the Application dispatches the creationComplete event.</li>
<li>Once the creationComplete event has been dispatched, the Preloader removes the DownloadProgressBar control and the SystemManager adds the Application instance to the Flash Player display list. (The Flash Player display list is basically the tree of visible or potentially visible objects that make up your application. When you add and remove child components to your application, your basically just adding and removing them from the display list).</li>
<li>Once the Application is added to the Flash Player display list, the Application dispatches its applicationComplete event</li>
<li>The Application has been created and is up on the screen ready to be interacted with.
  </li>
</ol>
<div id="pullquote-con">Better RUX using <span style="color: #990000;">custom preloaders</span>. </div>
<p>A well-known technique for displaying your own startup splash screen is to subclass the DownloadProgressBar control [or implement the IPreloaderDisplay interface]. Your custom display class can be used during the startup and that class can listen for 6 types of events:</p>
<ul>
<li>ProgressEvent.PROGRESS</li>
<li>Event.COMPLETE</li>
<li>FlexEvent.INIT_PROGRESS</li>
<li>FlexEvent.INIT_COMPLETE</li>
<li><span style="color: #990000;">RSLEvent.RSL_PROGRESS</span></li>
<li><span style="color: #990000;">RSLEvent.RSL_ERROR</span></li>
</ul>
<p>The last two are the interesting part&#8230; with those you can listen to events for RSL loading and errors. And, it is <span style="color: #0070C0;">during the preloader event dispatching phase</span> that you will manage/decrypt 1 or more encrypted RSLs. Here are the steps involved:</p>
<ol>
<li>The FlashPlayer loads an encrypted RSL/swf and dispatches an RSLError event; normally this kills the preload process and your application &quot;hangs&quot;.</li>
<li>Intercept that event and kill all event propogation to any other listeners; which effectively pauses all subsequent loading of other RSL still in the pending queue.</li>
<li>Using Nitro-LM, asynchronously request a RSA decryption key</li>
<li>Reload the encrypted RSL (in order to get clear access to the swf bytecode array)</li>
<li>Decrypt the byte array</li>
<li>Load the decrypted bytecode into the AVM</li>
<li>Notify the Preloader to resume loading all remaining pending RSLs</li>
</ol>
<p>So let&#8217;s look at the AS3 code for the custom display class that also supports RSL decryption:<br />
</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
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">package</span> tb.<span style="color: #660066;">preloader</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">display</span>.<span style="color: #660066;">Sprite</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">events</span>.<span style="color: #660066;">Event</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">events</span>.<span style="color: #660066;">ProgressEvent</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">import</span> mx.<span style="color: #660066;">core</span>.<span style="color: #660066;">RSLItem</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">import</span> mx.<span style="color: #660066;">core</span>.<span style="color: #660066;">RSLListLoader</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">import</span> mx.<span style="color: #660066;">core</span>.<span style="color: #660066;">mx_internal</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">import</span> mx.<span style="color: #660066;">events</span>.<span style="color: #660066;">RSLEvent</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">import</span> mx.<span style="color: #660066;">preloaders</span>.<span style="color: #660066;">Preloader</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">import</span> tb.<span style="color: #660066;">preloader</span>.<span style="color: #660066;">nitrolm</span>.<span style="color: #660066;">NitroDecryptor</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">use</span> <span style="color: #003366; font-weight: bold;">namespace</span> mx_internal<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">class</span> ThunderPreloader <span style="color: #003366; font-weight: bold;">extends</span> SplashDisplay
<span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">/**</span>
<span style="color: #006600; font-style: italic;">&nbsp;* Constructor for a Preloader subclass that supports on-demand RSL decryption</span>
<span style="color: #006600; font-style: italic;">&nbsp;* </span>
<span style="color: #006600; font-style: italic;">&nbsp;*/</span>
<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> ThunderPreloader<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #006600; font-style: italic;">/**</span>
<span style="color: #006600; font-style: italic;">&nbsp;* The code in the preloader setter below uses listeners to intercept RSLErrors and </span>
<span style="color: #006600; font-style: italic;">&nbsp;* handles the loading and decryptiong of encrypted RSLs. </span>
<span style="color: #006600; font-style: italic;">&nbsp;* </span>
<span style="color: #006600; font-style: italic;">&nbsp;* 		Note: The parent class is responsibile for the </span>
<span style="color: #006600; font-style: italic;">&nbsp;* 			  PROGRESS, COMPLETE, INIT_PROGRESS, INIT_COMPLETE events and handlers</span>
<span style="color: #006600; font-style: italic;">&nbsp;* </span>
<span style="color: #006600; font-style: italic;">&nbsp;* @param value IPreloaderDisplay subclasses used as interface to startup processes; that have been initiated by SystemManager. </span>
<span style="color: #006600; font-style: italic;">&nbsp;*/</span>
override <span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> set preloader<span style="color: #009900;">&#40;</span>value<span style="color: #339933;">:</span>Sprite<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">super</span>.<span style="color: #660066;">preloader</span> <span style="color: #339933;">=</span> value<span style="color: #339933;">;</span>
&nbsp;
	_preloader <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>value <span style="color: #000066; font-weight: bold;">as</span> Preloader<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	_preloader.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>RSLEvent.<span style="color: #660066;">RSL_PROGRESS</span><span style="color: #339933;">,</span> 	onRSLDownloadProgress <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	_preloader.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>RSLEvent.<span style="color: #660066;">RSL_ERROR</span><span style="color: #339933;">,</span> 	onRSLEncryptionDetected<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">999</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// **************************************************************</span>
<span style="color: #006600; font-style: italic;">//  RSL Event Handlers</span>
<span style="color: #006600; font-style: italic;">// **************************************************************</span>
&nbsp;
<span style="color: #006600; font-style: italic;">/**</span>
<span style="color: #006600; font-style: italic;">&nbsp;* Called during initial RSLEvent.RSL_ERROR; in our case</span>
<span style="color: #006600; font-style: italic;">&nbsp;* this is expected because the RSL is encrypted and cannot be properly loaded.</span>
<span style="color: #006600; font-style: italic;">&nbsp;* Kill the event propogation and invoke the NitroLM decryptor to reload a decrypted version </span>
<span style="color: #006600; font-style: italic;">&nbsp;* of the RSL.</span>
<span style="color: #006600; font-style: italic;">&nbsp;* </span>
<span style="color: #006600; font-style: italic;">&nbsp;* @param event  Initial RSLEvent.RSL_ERROR</span>
<span style="color: #006600; font-style: italic;">&nbsp;* </span>
<span style="color: #006600; font-style: italic;">&nbsp;*/</span>
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> onRSLEncryptionDetected<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span>RSLEvent<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">// Could be encrypted so reload it and check.</span>
	event.<span style="color: #660066;">stopImmediatePropagation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="display:block;background-color: #ffc;">	_decryptor.<span style="color: #660066;">loadAndDecrypt</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">url</span><span style="color: #339933;">,</span> onRSLDecryptedAndLoaded<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></span><span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">/**</span>
<span style="color: #006600; font-style: italic;">&nbsp;* Method invoked when the encrypted RSL has been decrypted and loaded into the AVM.</span>
<span style="color: #006600; font-style: italic;">&nbsp;* This causes the next RSL to start loading (if any available). </span>
<span style="color: #006600; font-style: italic;">&nbsp;* @param event</span>
<span style="color: #006600; font-style: italic;">&nbsp;* </span>
<span style="color: #006600; font-style: italic;">&nbsp;*/</span>
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> onRSLDecryptedAndLoaded<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span>Event<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">// We must manually force the Preloader to continue load all subsequent RSLs</span>
	<span style="color: #006600; font-style: italic;">// that are in the queue (after the current RSL has processed/loaded).</span>
	Preloader<span style="color: #009900;">&#40;</span>_preloader<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">mx_internal</span><span style="color: #339933;">::</span>resume<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">/**</span>
<span style="color: #006600; font-style: italic;">&nbsp;* Show the progress of the current RSL download relative to the total percentage </span>
<span style="color: #006600; font-style: italic;">&nbsp;* Not relevant to </span>
<span style="color: #006600; font-style: italic;">&nbsp;* @param event RSLEvent to update progress of load each RSL</span>
<span style="color: #006600; font-style: italic;">&nbsp;* </span>
<span style="color: #006600; font-style: italic;">&nbsp;*/</span>
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> onRSLDownloadProgress<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span>RSLEvent<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">// Now that are tracking on RSL loads, remove generic listener...</span>
	_preloader.<span style="color: #660066;">removeEventListener</span><span style="color: #009900;">&#40;</span>ProgressEvent.<span style="color: #660066;">PROGRESS</span><span style="color: #339933;">,</span> 	onDownload_Progress<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	centerOnScreen<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	progressBar.<span style="color: #660066;">progress</span> <span style="color: #339933;">=</span> calculatePercentDone<span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>progressBar.<span style="color: #660066;">visible</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>isReady<span style="color: #009900;">&#41;</span> progressBar.<span style="color: #660066;">visible</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// **************************************************************</span>
<span style="color: #006600; font-style: italic;">//  Private Attributes</span>
<span style="color: #006600; font-style: italic;">// **************************************************************</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> calculatePercentDone<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span>RSLEvent<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>Number <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> amountPerRSL   <span style="color: #339933;">:</span> Number <span style="color: #339933;">=</span> DOWNLOAD_PERCENTAGE <span style="color: #339933;">/</span> event.<span style="color: #660066;">rslTotal</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> alreadyLoaded  <span style="color: #339933;">:</span> Number <span style="color: #339933;">=</span> amountPerRSL <span style="color: #339933;">*</span> event.<span style="color: #660066;">rslIndex</span><span style="color: #339933;">;</span> 
	<span style="color: #003366; font-weight: bold;">var</span> currentLoading <span style="color: #339933;">:</span> Number <span style="color: #339933;">=</span> amountPerRSL <span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">bytesLoaded</span> <span style="color: #339933;">/</span> event.<span style="color: #660066;">bytesTotal</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">return</span>  alreadyLoaded <span style="color: #339933;">+</span> currentLoading<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #006600; font-style: italic;">/**</span>
<span style="color: #006600; font-style: italic;">&nbsp;* Decryptor facade class that hides complexities of asynchronous decryption </span>
<span style="color: #006600; font-style: italic;">&nbsp;* of encrtyped RSL.</span>
<span style="color: #006600; font-style: italic;">&nbsp;* </span>
<span style="color: #006600; font-style: italic;">&nbsp;* @private </span>
<span style="color: #006600; font-style: italic;">&nbsp;*/</span>
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> _decryptor      <span style="color: #339933;">:</span> NitroDecryptor <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> NitroDecryptor<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// **************************************************************</span>
<span style="color: #006600; font-style: italic;">//  Monkey-Patch Attributes (to force linker to load the patched classes)</span>
<span style="color: #006600; font-style: italic;">// **************************************************************</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> _preloader     <span style="color: #339933;">:</span> Preloader<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> _unused4       <span style="color: #339933;">:</span> RSLListLoader<span style="color: #339933;">;</span>	
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p></br></p>
<p>Because the Flex 3 &amp; 4 mx framework never planned for the use of encrypted RSLs, any RSLError event immediately stops the current and all other RSL load processes. In our situation, however, we do not consider an &quot;encryption error&quot; to be a real error&#8230; so we have to &quot;fix&quot; or monkey-patch the Flex codebase to support new &quot;resume()&quot; functionality. </p>
<p>Don&#8217;t worry, I have provided all that &quot;patch&quot; code in source code for this blog! In order to employ RSL encryption within your own Flex application(s), you will need:</p>
<ul>
<li>A Nitro-LM account and product encryption keyset</li>
<li>An application configured to load 1 or more RSLs during startup</li>
<li>A custom DownloadProgressBar display with support for RSL decryption </li>
<li>An Ant script to encrypt your RSL/swf (shown below) </li>
</ul>
<p>Below is a sample ANT script that you can use to encrypt a target Flex library using a Nitro-LM RSA private key:</p>
<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
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>project <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;Deploy EncryptedRSL Demo&quot;</span> basedir=<span style="color: #990000;">&quot;.&quot;</span> <span style="color: #0033ff; font-weight: bold;">default</span>=<span style="color: #990000;">&quot;encrypt.compiled.swc&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>property <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;library.name&quot;</span> 	<span style="color: #004993;">value</span>=<span style="color: #990000;">&quot;CairngormExtensions&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>property <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;flexsdk.dir&quot;</span> 	<span style="color: #004993;">value</span>=<span style="color: #990000;">&quot;/Users/thomasburleson/Documents/dev/flexSDK&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>property <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;bin.dir&quot;</span> 		<span style="color: #004993;">value</span>=<span style="color: #990000;">&quot;/Users/thomasburleson/Documents/dev/frameworks/CGX/build&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>property <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;deploy.dir&quot;</span> 	<span style="color: #004993;">value</span>=<span style="color: #990000;">&quot;/Users/thomasburleson/Documents/dev/samples/nitroLM/Flex4_encryptedRSL/bin-debug&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>property <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;build.dev&quot;</span> 		<span style="color: #004993;">value</span>=<span style="color: #990000;">&quot;/Users/thomasburleson/Documents/dev/samples/nitroLM/Flex4_encryptedRSL/build&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>property <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;tools.dir&quot;</span> 		<span style="color: #004993;">value</span>=<span style="color: #990000;">&quot;${build.dev}/tools/build&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>target <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;encrypt.compiled.swc&quot;</span> depends=<span style="color: #990000;">&quot;&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="display:block;background-color: #ffc;">		<span style="color: #000000; font-weight: bold;">&lt;</span>encryptSWC rsl<span style="color: #000000; font-weight: bold;">-</span>dir=<span style="color: #990000;">&quot;${bin.dir}/rsl&quot;</span> swc<span style="color: #000000; font-weight: bold;">-</span>dir=<span style="color: #990000;">&quot;${bin.dir}&quot;</span> swc<span style="color: #000000; font-weight: bold;">-</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;${library.name}&quot;</span> deploy<span style="color: #000000; font-weight: bold;">-</span>dir=<span style="color: #990000;">&quot;${deploy.dir}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>		<span style="color: #000000; font-weight: bold;">&lt;</span>delete dir=<span style="color: #990000;">&quot;${bin.dir}/rsl&quot;</span> quiet=<span style="color: #990000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;</span>echo <span style="color: #004993;">message</span>=<span style="color: #990000;">&quot;Finished build and encryption of: ${deploy.dir}/${library.name}.swf &quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>target<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;!--</span>
			Ant Definitions and Macros
		<span style="color: #000000; font-weight: bold;">--&gt;</span>	
&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;</span>taskdef <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;nitrolm-encrypt&quot;</span> classname=<span style="color: #990000;">&quot;com.simplifiedlogic.nitrolm.LMEncryptAsset&quot;</span> classpath=<span style="color: #990000;">&quot;${tools.dir}/jars/AssetEncrypterX.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;</span>macrodef <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;encryptSWC&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>attribute <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;rsl-dir&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>attribute <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;swc-dir&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>attribute <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;swc-name&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>attribute <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;version-stamp&quot;</span> <span style="color: #0033ff; font-weight: bold;">default</span>=<span style="color: #990000;">&quot;&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">&lt;</span>attribute <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;deploy-dir&quot;</span>       <span style="color: #0033ff; font-weight: bold;">default</span>=<span style="color: #990000;">&quot;${deploy.dir}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>attribute <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;encrypt-keys-dir&quot;</span> <span style="color: #0033ff; font-weight: bold;">default</span>=<span style="color: #990000;">&quot;${tools.dir}/nitro_lm/keys&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">&lt;</span>sequential<span style="color: #000000; font-weight: bold;">&gt;</span>
				<span style="color: #000000; font-weight: bold;">&lt;!--</span>   Process
&nbsp;
					<span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span> Extract the SWF from the SWC <span style="color: #000000;">&#40;</span>RSL that should be encrypted<span style="color: #000000;">&#41;</span>
				    <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> Optimize the RSL <span style="color: #000000;">&#40;</span>remove debug <span style="color: #004993;">info</span> and <span style="color: #004993;">compress</span><span style="color: #000000;">&#41;</span>
				    <span style="color: #000000; font-weight:bold;">3</span><span style="color: #000000;">&#41;</span> Encrypt the SWF<span style="color: #000000; font-weight: bold;">/</span>RSL <span style="color: #0033ff; font-weight: bold;">with</span> Nitro<span style="color: #000000; font-weight: bold;">-</span>LM tools and keys
				    <span style="color: #000000; font-weight:bold;">4</span><span style="color: #000000;">&#41;</span> Deploy the encrypted RSL
				    <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000000;">&#41;</span> Update the <span style="color: #004993;">target</span> SWC digest <span style="color: #0033ff; font-weight: bold;">with</span> the encrypted RSL checksum 
				       <span style="color: #000000; font-weight: bold;">-</span> The <span style="color: #990000;">&quot;parent&quot;</span> app that loads the RSL uses the SWC<span style="color: #000000; font-weight: bold;">/</span>updated digest <span style="color: #004993;">value</span> to
				       <span style="color: #000000; font-weight: bold;">-</span> insure that the RSL <span style="color: #0033ff; font-weight: bold;">is</span> the <span style="color: #990000;">&quot;expected&quot;</span> RSL and not a pirated one<span style="color: #000000; font-weight: bold;">!</span>
				<span style="color: #000000; font-weight: bold;">--&gt;</span>
&nbsp;
				<span style="color: #000000; font-weight: bold;">&lt;</span>unzip src=<span style="color: #990000;">&quot;@{swc-dir}/@{swc-name}.swc&quot;</span>
					dest=<span style="color: #990000;">&quot;@{rsl-dir}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
					<span style="color: #000000; font-weight: bold;">&lt;</span>patternset<span style="color: #000000; font-weight: bold;">&gt;</span>
	                   <span style="color: #000000; font-weight: bold;">&lt;</span>include <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;library.swf&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
					<span style="color: #000000; font-weight: bold;">&lt;/</span>patternset<span style="color: #000000; font-weight: bold;">&gt;</span> 
				<span style="color: #000000; font-weight: bold;">&lt;/</span>unzip<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
				<span style="color: #000000; font-weight: bold;">&lt;</span>java jar=<span style="color: #990000;">&quot;${flexsdk.dir}/lib/optimizer.jar&quot;</span> fork=<span style="color: #990000;">&quot;true&quot;</span> failonerror=<span style="color: #990000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
					<span style="color: #000000; font-weight: bold;">&lt;</span>jvmarg line=<span style="color: #990000;">&quot;-ea -DAS3 -DAVMPLUS -Dflexlib=${flexsdk.dir}/frameworks -Xms32m -Xmx384m -Dsun.io.useCanonCaches=false&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
					<span style="color: #000000; font-weight: bold;">&lt;</span>arg line=<span style="color: #990000;">&quot;'@{rsl-dir}/library.swf' --output '@{rsl-dir}/library.swf' --keep-as3-metadata='Bindable,Managed,ChangeEvent,NonCommittingChangeEvent,Transient' &quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
				<span style="color: #000000; font-weight: bold;">&lt;/</span>java<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
				<span style="color: #000000; font-weight: bold;">&lt;!--</span> encrypt the swf to protect 
					 Here, I am using my <span style="color: #0033ff; font-weight: bold;">private</span> key downloaded from my Nitro<span style="color: #000000; font-weight: bold;">-</span>LM account
					 @ https<span style="color: #000000; font-weight: bold;">:</span><span style="color: #009900;">//license.nitromation.com/NitroAdminLite/index.html</span>
				<span style="color: #000000; font-weight: bold;">--&gt;</span>
				<span style="color: #000000; font-weight: bold;">&lt;</span>nitrolm<span style="color: #000000; font-weight: bold;">-</span>encrypt
					filename=<span style="color: #990000;">&quot;@{rsl-dir}/library.swf&quot;</span>
					product=<span style="color: #990000;">&quot;6LMLulqf9VN9AmbFzKky&quot;</span>
					library=<span style="color: #990000;">&quot;6LMLulqf9VN9AmbFzKky&quot;</span>
					keydir=<span style="color: #990000;">&quot;@{encrypt-keys-dir}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
&nbsp;
				<span style="color: #000000; font-weight: bold;">&lt;</span>delete file=<span style="color: #990000;">&quot;@{deploy-dir}/@{swc-name}.swf&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
				<span style="color: #000000; font-weight: bold;">&lt;</span>copy file=<span style="color: #990000;">&quot;@{rsl-dir}/library.swf&quot;</span> tofile=<span style="color: #990000;">&quot;@{deploy-dir}/@{swc-name}@{version-stamp}.swf&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
				<span style="color: #000000; font-weight: bold;">&lt;!--</span> Update the digest <span style="color: #004993;">value</span> <span style="color: #0033ff; font-weight: bold;">in</span> the .swc so linking applications will use the updated digest <span style="color: #004993;">value</span> 
				     Do not worry about the library.swf inside the SWC being the original <span style="color: #004993;">version</span>...
				<span style="color: #000000; font-weight: bold;">--&gt;</span>
				<span style="color: #000000; font-weight: bold;">&lt;</span>java jar=<span style="color: #990000;">&quot;${flexsdk.dir}/lib/digest.jar&quot;</span> fork=<span style="color: #990000;">&quot;true&quot;</span> failonerror=<span style="color: #990000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
					<span style="color: #000000; font-weight: bold;">&lt;</span>jvmarg line=<span style="color: #990000;">&quot;-ea -DAS3 -DAVMPLUS -Dflexlib=${flexsdk.dir}/frameworks -Xms32m -Xmx384m -Dsun.io.useCanonCaches=false&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
					<span style="color: #000000; font-weight: bold;">&lt;</span>arg line=<span style="color: #990000;">&quot;--digest.rsl-file  @{rsl-dir}/library.swf --digest.swc-path  @{swc-dir}/@{swc-name}.swc&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
				<span style="color: #000000; font-weight: bold;">&lt;/</span>java<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
&nbsp;
			<span style="color: #000000; font-weight: bold;">&lt;/</span>sequential<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;/</span>macrodef<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;/</span>project<span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

</p>
<p>Click here to download the <a href="http://www.gridlinked.info/slides/demoEncryptedRSLs.zip" target="_parent">FlashBuilder 4 Demo project </a>(and ant build script) used for the demo above. You can even use the Custom Preloader display solutions to rapidly create your own. </p>
<p>So what is next? Well, if you have non-trivial flex applications you may want to deliver some of the following support:</p>
<ul>
<li>want to partition your code into multiple RSLs ?  </li>
<li>need to provide on-demand compiles and encryption of multiple RSLs ? </li>
<li>want to version stamp those RSLs based on tags in SVN, CVS, or GIT ?</li>
<li>want to optimize filesizes for all deployed, production components ?</li>
<li>want to auto-deploy components with version-stamps ?</li>
<li>want to configure CruiseControl for automated builds and deploys ?</li>
</ul>
<p><br/>If you need help with these, contact me. My professional life is as an RIA Flex/Flash consultant, entrepreneur, developer, architect, and mentor. So give me a shout out at <span style="color: #800000">Thomas dot Burleson at ThunderbaySoft dot com</span>.</p>
<br /><div><img src="http://www.gridlinked.info/wp-content/plugins/gd-star-rating/gfx.php?value=10.0" /></div><div>Rating: 10.0/<strong>10</strong> (5 votes cast)</div><br /><hr />
<p><small>© Thomas Burleson for <a href="http://www.gridlinked.info">GridLinked to RUX</a>, 2009.   
&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;  
<a href="http://feedburner.google.com/fb/a/mailverify?uri=GridlinkedToRux&amp;loc=en_US"><span style="color:#900">Subscribe by Email</span></a> |
<a href="mailto:ThomasBurleson@GMail.com">Contact Author</a> 	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;
<a href="http://www.gridlinked.info/how-to-encrypt-flex-rsls/">Permalink</a> |    
<a href="http://www.gridlinked.info/how-to-encrypt-flex-rsls/#comments">7 comments</a>
<br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.gridlinked.info/how-to-encrypt-flex-rsls/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Flex Behavior Injection (like jQuery)</title>
		<link>http://www.gridlinked.info/flex-behavior-injection/</link>
		<comments>http://www.gridlinked.info/flex-behavior-injection/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 23:29:52 +0000</pubDate>
		<dc:creator>thomasb</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Talks]]></category>
		<category><![CDATA[behavior]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[flexCamp]]></category>
		<category><![CDATA[interactions]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[zoom]]></category>

		<guid isPermaLink="false">http://gridlinked.info/wordpress/?p=20</guid>
		<description><![CDATA[The "Flex Behavior Injection" approach to component development and architectures will change your perspective on Flex software development.<br /><div><img src="http://www.gridlinked.info/wp-content/plugins/gd-star-rating/gfx.php?value=9.2" /></div><div>Rating: 9.2/<strong>10</strong> (5 votes cast)</div><br />]]></description>
			<content:encoded><![CDATA[<p><strong><em>This approach</em></strong> to component development and architectures will change your perspective on Flex software development! Consider the myriad situations when you want to add sophisticated functionality like <span style="color: #0070C0;">zoom</span>, <span style="color: #0070C0; ">drag-n-drop</span>, <span style="color: #0070C0; ">swapping</span>, <span style="color: #0070C0;">MDI window minimizing</span>, etc. Instead of designing subclasses or building complex compositions of nested components, developers can create distinct <span style="color: #800000">behavior components</span>. These behavior components are then dynamically attached to target components and <span style="color: #800000;">inject functionality</span>.</p>
<p>I must admit that this software concept is not new. Consider the very popular <a href="http://docs.jquery.com/UI/Resizable" target="_blank"><span style="text-decoration: underline;">JQuery UI Interactions</span></a>. The JQuery UI Resizable code provides functionality to allow 1 or more HTML components to be dynamically resized. Other functionality exists for dragging, dropping, selecting, etc.</p>
<div id="pullquote-con">Using Flex technologies, can we have this same sort of functionality where behaviors are <span style="color: #800000">injected or attached</span> to target components upon demand ?</div>
<p>During Jan &#8216;09 &#8211; at FlexCamp OC in Irvine, CA &#8211; I presented a new topic called <a href="http://www.flexcampoc.com/" target="_blank"><span style="text-decoration: underline;">Flex Behavior Injection</span></a>.  Below is an improved version of the slide deck that I presented at that conference. These slides are interactive; simply click to go to the next or previous slide. You can also zoom the slides using the slide control bar&#8230;</p>
<p><center><br />
<object width="425" height="348"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=flexbehaviourinjection-090303105114-phpapp02"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=flexbehaviourinjection-090303105114-phpapp02"  type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="348"></embed></object><!-- ysttest:Array
(
    [id] => 1095693&amp;doc=flexbehaviourinjection-090303105114-phpapp02&amp;w=425
)
--><br />
</center></p>
<p>Of course, what good is a slide deck without a live application and code samples? Below is a live version of a well-known Adobe application that demonstrates a charting dashboard solution with multi-chart interactions. Selecting a data point on a chart triggers filters and auto-updates dependent charts. With two (2) lines of code, I have enhanced that application to use injected behaviors for <span style="color: #0070C0;">swapping</span> and <span style="color: #0070C0; ">zooming</span>. Click the picture below to play with the live Flex application. </p>
<p>Here are some helpful tips: To zoom, use the toolbar to select which chart you want to zoom, then click the Zoom button.<br/><br />
To swap a chart:</p>
<ol>
<li>Select the &#8216;Enable Swap&#8217; checkbox,</li>
<li>Then move your mouse over the bottom area of any of the chart panels,</li>
<li>The cursor will change to a hand-cursor,</li>
<li>Click and drag a chart to see how dynamic swapping works</li>
</ol>
<div id="pullquote-con">Snap-to, animation, dragging, <span style="color: #800000">real-time swapping</span>, and constraints are all handled by the Swapper behavior! You can drag a chart, drop anywhere, and the current chart will <span style="color: #800000">snap</span> into place&#8230;</div>
<p>As you drag a chart around, watch how the other charts will swap positions dynamically, on-the-fly as you drag. Even better, with view states, your chart could be coded to change reconfig its states after resizing&#8230; so swapping could also change the layouts of each chart. For example, if placed in an narrow vertical area, the panel could change state to display a datagrid instead of a chart&#8230; you can imagine the sensation and rich user experience that you could offer to users.</p>
<div class="img aligncenter" style="width:403px;">
	<a style="color: #ffffff;" rel="lightbox" href="http://www.gridlinked.info/flash/dashboard4/dashboard4.html"><img src="/flash/dashboard4/dashboard4_proxy.jpg" alt="Chart Dashboard with Behaviors" width="403" height="309" /></a>
	<div>Figure 1: Chart Dashboard with Behaviors (click to launch)</div>
</div>
<p>Below is the main code for the sample application. Notice the Zoomer component tag that is highlighted on line 14. When activated (click event on line 26), the Zoomer handles all nesting and constraint issues for the target component when it zooms. And &#8211; best of all &#8211; the Zoomer handles details of un-zooming the component back to its original settings/location. You can easily imagine the enormous pain of trying to manually cache and restore settings and anchors&#8230;<br />
<br/></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
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application xmlns<span style="color: #000000; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
		<span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span> <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _target <span style="color: #000000; font-weight: bold;">:</span> UIComponent = <span style="color: #0033ff; font-weight: bold;">null</span>;
        <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">&lt;!--</span> RPC Dataservice component <span style="color: #0033ff; font-weight: bold;">for</span> the chart <span style="color: #004993;">XML</span> <span style="color: #004993;">data</span> <span style="color: #000000; font-weight: bold;">--&gt;</span> 
   <span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>HTTPService id=<span style="color: #990000;">&quot;srv&quot;</span> <span style="color: #004993;">url</span>=<span style="color: #990000;">&quot;/data/dashboard4.xml&quot;</span> useProxy=<span style="color: #990000;">&quot;false&quot;</span> result=<span style="color: #990000;">&quot;resultHandler(event)&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">&lt;!--</span> Behavior components <span style="color: #000000; font-weight: bold;">--&gt;</span>
<span style="display:block;background-color: #ffc;">    <span style="color: #000000; font-weight: bold;">&lt;</span>behaviour<span style="color: #000000; font-weight: bold;">:</span>Zoomer	id=<span style="color: #990000;">&quot;zoomer&quot;</span> <span style="color: #004993;">target</span>=<span style="color: #990000;">&quot;{_target}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>   <span style="color: #000000; font-weight: bold;">&lt;</span>swap<span style="color: #000000; font-weight: bold;">:</span>Swapper 	id=<span style="color: #990000;">&quot;swapper&quot;</span> 
			allowedDrops=<span style="color: #990000;">&quot;{[allRegions,regionBreakdown,regionDetail]}&quot;</span> 
			<span style="color: #004993;">active</span>=<span style="color: #990000;">&quot;{_canSwap}&quot;</span> 	<span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>ApplicationControlBar <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;5&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Label <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;Chart to Zoom:&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>RadioButton label=<span style="color: #990000;">&quot;All Regions&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;_target = allRegions;&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>RadioButton label=<span style="color: #990000;">&quot;Breakdown&quot;</span>   <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;_target = regionBreakdown;&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>RadioButton label=<span style="color: #990000;">&quot;Details&quot;</span>     <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;_target = regionDetail;&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;{zoomer.isZoomed ? 'UnZoom' : 'Zoom'}&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;zoomer.play();&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>            
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Spacer <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>		
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>CheckBox label=<span style="color: #990000;">&quot;Swap Enabled&quot;</span> selected=<span style="color: #990000;">&quot;false&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;_canSwap = (event.target as CheckBox).selected;&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>ApplicationControlBar<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Canvas id=<span style="color: #990000;">&quot;content&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;50&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;10&quot;</span> label=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;10&quot;</span> horizontalScrollPolicy=<span style="color: #990000;">&quot;off&quot;</span> verticalScrollPolicy=<span style="color: #990000;">&quot;off&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;</span>views<span style="color: #000000; font-weight: bold;">:</span>AllRegions   id=<span style="color: #990000;">&quot;allRegions&quot;</span>	
	    		 <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;{content.width/2 - 10}&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span>  <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;0&quot;</span>
	    		 revenueData=<span style="color: #990000;">&quot;{slicedMonthData.source}&quot;</span> 
			 monthChange=<span style="color: #990000;">&quot;monthChange()&quot;</span>   	<span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">&lt;</span>views<span style="color: #000000; font-weight: bold;">:</span>RegionBreakdown id=<span style="color: #990000;">&quot;regionBreakdown&quot;</span> 
			<span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;{content.width/2}&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;{content.height/2 - 10}&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;0&quot;</span> 
			regionChange=<span style="color: #990000;">&quot;regionChange()&quot;</span>   <span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">&lt;</span>views<span style="color: #000000; font-weight: bold;">:</span>RegionDetail id=<span style="color: #990000;">&quot;regionDetail&quot;</span> 	 
			<span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;{content.width/2}&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;0&quot;</span>   <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;{content.height/2 - 10}&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;0&quot;</span> 
			revenueData=<span style="color: #990000;">&quot;{slicedRegionData.source}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Canvas<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application<span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>This concept is very powerful. Your view components are not required to know about zooming or swapping (etc.) nor are you &#8211; the developer &#8211; required to configure special view hierarchies or plan for other considerations. Your coding style remains unchanged and your framework(s) [e.g. Cairngorm, CGX, Mate, etc.] remains unchanged.</p>
<p>Many people have asked for the source code to these components. This code will be open-sourced soon and the release is planned within the near future. Please consider rating this blog post and submitting some comments. You may subscribe to my blog RSS for auto-notifications when the <span style="color: #800000">Flex Behavior library</span> is released. <img src='http://www.gridlinked.info/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
<br/></p>
<br /><div><img src="http://www.gridlinked.info/wp-content/plugins/gd-star-rating/gfx.php?value=9.2" /></div><div>Rating: 9.2/<strong>10</strong> (5 votes cast)</div><br /><hr />
<p><small>© Thomas Burleson for <a href="http://www.gridlinked.info">GridLinked to RUX</a>, 2009.   
&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;  
<a href="http://feedburner.google.com/fb/a/mailverify?uri=GridlinkedToRux&amp;loc=en_US"><span style="color:#900">Subscribe by Email</span></a> |
<a href="mailto:ThomasBurleson@GMail.com">Contact Author</a> 	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;
<a href="http://www.gridlinked.info/flex-behavior-injection/">Permalink</a> |    
<a href="http://www.gridlinked.info/flex-behavior-injection/#comments">5 comments</a>
<br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.gridlinked.info/flex-behavior-injection/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Porting Flash to Flex &#8211; Elastic Cords</title>
		<link>http://www.gridlinked.info/elastic-cords-porting-flash-to-flex/</link>
		<comments>http://www.gridlinked.info/elastic-cords-porting-flash-to-flex/#comments</comments>
		<pubDate>Sun, 19 Mar 2006 05:00:53 +0000</pubDate>
		<dc:creator>thomasb</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[designer]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[interactions]]></category>
		<category><![CDATA[migrate]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[timeline]]></category>

		<guid isPermaLink="false">http://www.gridlinked.info/?p=116</guid>
		<description><![CDATA[Porting such RIA applications from Flash 8 to Flex 2 - where the concepts of timelines are deprecated - presents challenges. When you consider that most Flex projects are business-oriented applications...<br /><div><img src="http://www.gridlinked.info/wp-content/plugins/gd-star-rating/gfx.php?value=8.5" /></div><div>Rating: 8.5/<strong>10</strong> (2 votes cast)</div><br />]]></description>
			<content:encoded><![CDATA[<p>Recently, <a href="http://www.ericd.net/new_css/">Eric Dolecki</a> published a Flash 8 version of a very cool Elastic Cords flash application. I am sure he was &#8211; as I am &#8211; inspired by the works of <a href="http://void.andre-michelle.com/">Andre Michelle</a>. This application, of course, does nothing commercially practical but does demonstrate great features of the FP8 API. I, of course, decided to continue that tradition. I wanted to create a Flex, object-oriented, component version&#8230;</p>
<p>All too often I find great visual applications with great experiences&#8230; are more often created in Flash not Flex. And unfortunately, their code (if published) is usually <span style="color: #0070C0; ">procedural</span> and <span style="color: #0070C0; ">timeline-based</span> instead of the <span style="color: #0070C0; ">component-based</span> approaches that come so easily in Flex.</p>
<div id="pullquote-con">Flash 8/CS3/CS4 is a tool intended primarily for designers.<br />
While Flex is a tool focused primarily on <span style="color: #800000">developer teams</span> &amp; object-oriented, coding techniques.</div>
<p>Porting such RIA applications from Flash 8 to Flex 2 &#8211; where the concepts of timelines are deprecated &#8211; presents challenges. When you consider that most Flex projects are business-oriented applications that do not require dynamic stage-drawing interactions (like the Elastic Cords), then this project was the perfect impetus for me to explore and understand some <strong>major</strong> conceptual differences between Flash and Flex; differences such <span style="color: #0070C0; ">UI interactions</span>, <span style="color: #0070C0; ">tweenings</span>, <span style="color: #0070C0; ">component coupling</span>, etc..</p>
<div class="img aligncenter" style="width:386px;">
	<a rel="lightbox;height=550;width=700" href="http://www.gridlinked.info/flash/elasticCords/cords.html"><img src="/flash/elasticCords/cords.jpg" alt="Elastic Cords Demo" width="386" height="280" /></a>
	<div>Figure 1: Elastic Cords Demo (click to launch)</div>
</div>
<p>I knew the effort would prove to be quite fun and challenging. In fact, I first became obsessed with the development efforts and solutions. Then I became obsessed the playing with the demo and dragging those ridiculous cords around.[So be forewarned <img src='http://www.gridlinked.info/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> ]</p>
<p>Click on the sockets on the left to create new cords. Watch the new cords elastically bounced out and fall to the ground in a simulation of elasticity and gravity. You can click and drag the loose end(s) of the cords around. Watch the cords bounce and sway as you move the endpoint. Then you can release the end-point near the &#8220;drop&#8221; sockets and watch them snap into the dock sockets.</p>
<p>The source code is available! Simply right-click on the running application and <span style="color: #800000">View Source</span>.</p>
<p>Enjoy.</p>
<br /><div><img src="http://www.gridlinked.info/wp-content/plugins/gd-star-rating/gfx.php?value=8.5" /></div><div>Rating: 8.5/<strong>10</strong> (2 votes cast)</div><br /><hr />
<p><small>© Thomas Burleson for <a href="http://www.gridlinked.info">GridLinked to RUX</a>, 2006.   
&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;  
<a href="http://feedburner.google.com/fb/a/mailverify?uri=GridlinkedToRux&amp;loc=en_US"><span style="color:#900">Subscribe by Email</span></a> |
<a href="mailto:ThomasBurleson@GMail.com">Contact Author</a> 	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;
<a href="http://www.gridlinked.info/elastic-cords-porting-flash-to-flex/">Permalink</a> |    
<a href="http://www.gridlinked.info/elastic-cords-porting-flash-to-flex/#comments">2 comments</a>
<br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.gridlinked.info/elastic-cords-porting-flash-to-flex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
