<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>assertTrue: Library Type Assets in ActionScript 3.0 :: using assets created with current releases of Flash Authoring</title>
    <link>http://www.asserttrue.com/articles/2006/05/16/library-type-assets-in-actionscript-3-0-using-assets-created-with-current-releases-of-flash-authoring</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>powered by Pattern Park</description>
    <item>
      <title>Library Type Assets in ActionScript 3.0 :: using assets created with current releases of Flash Authoring</title>
      <description>&lt;p&gt;In the previous post &lt;a href="http://www.asserttrue.com/articles/2006/04/18/library-type-assets-in-actionscript-3-0-using-the-embed-metatdata-tag"&gt;Library Type Assets in ActionScript 3.0 :: using the [Embed] metatdata tag&lt;/a&gt;, I mentioned that an &lt;a href="http://labs.adobe.com/technologies/actionscript3/"&gt;ActionScript 3.0&lt;/a&gt; application can load library type assets (i.e. SWFs) created in current releases of &lt;a href="http://www.adobe.com/products/flash/flashpro/"&gt;Flash Authoring&lt;/a&gt; during run time.  This is a big deal &amp;#8211; a huge deal &amp;#8211; because without this ability there wouldn&amp;#8217;t be any way to create a &lt;a href="http://livedocs.macromedia.com/labs/1/flex20beta3/langref/flash/display/MovieClip.html"&gt;MovieClip&lt;/a&gt; and include it in a &lt;a href="http://labs.adobe.com/technologies/flexbuilder2/"&gt;Flex Builder 2.0&lt;/a&gt; project until &lt;a href="http://weblogs.macromedia.com/md/archives/2005/10/codename_for_th.cfm"&gt;Blaze&lt;/a&gt; becomes available.&lt;/p&gt;


	&lt;p&gt;The simplest way to load a legacy &lt;span class="caps"&gt;SWF&lt;/span&gt; is with the &lt;a href="http://livedocs.macromedia.com/labs/1/flex20beta3/langref/flash/display/Loader.html"&gt;Loader&lt;/a&gt; class.  After it&amp;#8217;s loaded, you can manipulate its &lt;a href="http://livedocs.macromedia.com/labs/1/flex20beta3/langref/flash/display/DisplayObject.html"&gt;DisplayObject&lt;/a&gt; properties with the &lt;a href="http://labs.adobe.com/technologies/flashplayer9/"&gt;Flash 9 Player&lt;/a&gt;&amp;#8217;s &lt;a href="http://livedocs.macromedia.com/labs/1/flex20beta3/langref/flash/display/AVM1Movie.html"&gt;AVM1Movie&lt;/a&gt; adapter class.&lt;/p&gt;


	&lt;p&gt;While this method works well for canned widgets like video and music players that don&amp;#8217;t need to communicate with their host application, it doesn&amp;#8217;t work well when host communication is a requirement.  When this is a requirement, it&amp;#8217;s necessary to take advantage of features available through the &lt;a href="http://livedocs.macromedia.com/labs/1/flex20beta3/langref/flash/net/LocalConnection.html"&gt;LocalConnection&lt;/a&gt;  class, because the only way for &lt;a href="http://labs.adobe.com/technologies/actionscript3/"&gt;ActionScript 3.0&lt;/a&gt; running in the &lt;span class="caps"&gt;AVM2&lt;/span&gt; to communicate with legacy ActionScript running in the &lt;span class="caps"&gt;AVM1&lt;/span&gt;  is over a &lt;a href="http://livedocs.macromedia.com/labs/1/flex20beta3/langref/flash/net/LocalConnection.html"&gt;LocalConnection&lt;/a&gt; .&lt;/p&gt;


	&lt;p&gt;While researching an elegant solution to the problem of how two pieces of code (AS2 and &lt;span class="caps"&gt;AS3&lt;/span&gt;) running in two separate virtual machines (AVM1 and &lt;span class="caps"&gt;AVM2&lt;/span&gt;) can communicate, I looked to the book &lt;a href="http://martinfowler.com/books.html#eip"&gt;Enterprise Integration Patterns : Designing, Building, and Deploying Messaging Solutions&lt;/a&gt; from the signature series of one of my favorite authors &lt;a href="http://www.martinfowler.com/"&gt;Martin Fowler&lt;/a&gt;.  Chapter 2 of the book explores different integration styles and suggests that the &lt;em&gt;Remote Procedure Invocation&lt;/em&gt; approach is a, &amp;#8220;mechanism for one application to invoke a function in another application, passing the data that needs to be shared and invoking the function that tells the receiver application how to process the data.&amp;#8221;  After reading this and the rest of the section (the full &lt;em&gt;Remote Procedure Invocation&lt;/em&gt; section can be found online at &lt;a href="http://www.awprofessional.com/articles/article.asp?p=169483&amp;#38;seqNum=4"&gt;http://www.awprofessional.com/articles/article.asp?p=169483&amp;#38;seqNum=4&lt;/a&gt;), I was convinced that the &lt;em&gt;Remote Procedure Invocation&lt;/em&gt;
approach would work and designed an &lt;span class="caps"&gt;AS3&lt;/span&gt; stub and &lt;span class="caps"&gt;AS2&lt;/span&gt; skeleton class.  They follow:&lt;/p&gt;</description>
      <pubDate>Tue, 16 May 2006 20:12:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:39928824-eba2-4b2e-b7e4-0bfba4ccc2db</guid>
      <author>Ali Mills</author>
      <link>http://www.asserttrue.com/articles/2006/05/16/library-type-assets-in-actionscript-3-0-using-assets-created-with-current-releases-of-flash-authoring</link>
      <category>actionscript</category>
      <trackback:ping>http://www.asserttrue.com/articles/trackback/25</trackback:ping>
    </item>
  </channel>
</rss>
