<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.2" -->
<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/"
	>

<channel>
	<title>Professional Monkey Keyboard Operator</title>
	<link>http://www.pmko.net</link>
	<description>one monkey's view of our interactive world</description>
	<pubDate>Mon, 02 Jun 2008 05:06:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>
	<language>en</language>
			<item>
		<title>Adobe&#8217;s keeping ActionScript developers employed</title>
		<link>http://www.pmko.net/interactive/adobes-keeping-actionscript-developers-employed/</link>
		<comments></comments>
		<pubDate>Mon, 02 Jun 2008 05:02:50 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
		<category><![CDATA[Interactive]]></category>

		<guid isPermaLink="false">/interactive/adobes-keeping-actionscript-developers-employed/</guid>
		<description><![CDATA[The last couple years have been filled with tons of new technologies related to the Flash Player, so much so that it is very hard as a developer to keep up with it all.  Most of the things that we get to learn is tied directly to what clients are comfortable with and able [...]]]></description>
			<content:encoded><![CDATA[The last couple years have been filled with tons of new technologies related to the Flash Player, so much so that it is very hard as a developer to keep up with it all.  Most of the things that we get to learn is tied directly to what clients are comfortable with and able to pay for.  As an example, of all the many projects that I have worked on over the years, only one has paid to have a Flash Media Server added to their hosting environment for the better of the project (PepsiCo for dewmocracy.com).  Although I had played around with FMS, I had never done anything serious with it before and finally learned all it's glorious secrets.
<br /><br />
The point here is that Flash development is actually a legitimate career choice.  This technology has been around for over 10 years now and it's only getting better. The proof in this statement is in Adobe's latest efforts in bringing Flash to the masses.  Announced on May 1st, 2008, the <a href="http://www.adobe.com/openscreenproject/" target="_blank">Open Screen Project </a>represents a huge leap forward for the overall reach of Flash technology and a pretty bright future for us Flash devotees.  I strongly recommend that you keep an eye on what Adobe has planned for our future by keeping up on the latest and here's a few places to see it unfold:<br />
<a href="http://labs.adobe.com" target="_blank">labs.adobe.com</a><br />
<a href="http://opensource.adobe.com" target="_blank">opensource.adobe.com</a>
<br /><br />
Thank you <a href="http://www.klynch.com" target="_blank">Kevin Lynch</a>.]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		</item>
		<item>
		<title>Embedding fonts in an ActionScript Project</title>
		<link>http://www.pmko.net/flex/embedding-fonts-in-an-actionscript-project/</link>
		<comments></comments>
		<pubDate>Fri, 16 May 2008 04:21:52 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
		<category><![CDATA[code example]]></category>

		<category><![CDATA[ActionScript 3]]></category>

		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">/flex/embedding-fonts-in-an-actionscript-project/</guid>
		<description><![CDATA[Working with ActionScript projects can offer some rather interesting challenges with some of the most basic parts of Flash development.  Things like preloading your application and using linked MovieClips from a library, not to mention using embedded fonts in your TextFields. This really becomes interesting when you want to use more than one font [...]]]></description>
			<content:encoded><![CDATA[Working with ActionScript projects can offer some rather interesting challenges with some of the most basic parts of Flash development.  Things like <a href="http://www.bit-101.com/blog/?p=946" target="_blank">preloading</a> your application and using linked MovieClips from a library, not to mention using embedded fonts in your TextFields. This really becomes interesting when you want to use more than one font in a single TextField.  And sure you can embed font files right into the AS class, but that doesn't always work.  I've had numerous issues with <a href="http://en.wikipedia.org/wiki/OpenType" target="_blank">otf</a> fonts.
<br /><br />
The method that I have had the best success with is using the same technique as embedding symbols from Flash AS2 swfs.  Here's a step-by-step on how to do this.<br /><br />
1) Create a new FLA and set to publish to Flash 9 / AS2.<br />
<p align="center"><img src="/wp-content/uploads/2008/05/embed_step1.jpg" alt="" /></p>

2) Create a New Font in the Library.<br />
<p align="center"><img src="/wp-content/uploads/2008/05/embed_step2.jpg" alt="" /></p>

3) Set the Linkage to export for ActionScript on the first frame.<br />
<p align="center"><img src="/wp-content/uploads/2008/05/embed_step3.jpg" alt="" /></p>
<p align="center"><img src="/wp-content/uploads/2008/05/embed_step3-5.jpg" alt="" /></p>

4) Publish the swf to a directory within your project.<br />
<p align="center"><img src="/wp-content/uploads/2008/05/embed_step4.jpg" alt="" /></p>

5) Set non-embeded files to not copy to bin<br />
<p align="center"><img src="/wp-content/uploads/2008/05/embed_step5.jpg" alt="" /></p>

6) Associate a standard Embed meta tag with a property of the class.<br />
7) Create a new StyleSheet.<br />
8) Create a style with fontFamily set to the name of the embedded symbol.<br />
8) Assign the StyleSheet<br />
<pre><span class="asPackage">package</span> <span class="asBracket">{</span>
    <span class="asReserved">import</span> flash.display.Sprite;
    <span class="asReserved">import</span> flash.text.AntiAliasType;
    <span class="asReserved">import</span> flash.text.StyleSheet;
    <span class="asReserved">import</span> flash.text.TextField;
    <span class="asReserved">import</span> flash.text.TextFieldAutoSize;
    
    <span class="asBracket">[</span>SWF<span class="asBracket">(</span>width<span class="asOperator">=</span><span class="asString">&quot;450&quot;</span>, height<span class="asOperator">=</span><span class="asString">&quot;60&quot;</span>, backgroundColor<span class="asOperator">=</span><span class="asString">&quot;#CCCCCC&quot;</span>, frameRate<span class="asOperator">=</span><span class="asString">&quot;30&quot;</span><span class="asBracket">)]</span>
    <span class="asReserved">public</span> <span class="asClass">class</span> EmbeddedFonts <span class="asReserved">extends</span> Sprite <span class="asBracket">{</span>
        <span class="asReserved">private</span> <span class="asVar">var</span> _style<span class="asOperator">:</span>StyleSheet;
        <span class="asReserved">private</span> <span class="asVar">var</span> _copy<span class="asOperator">:</span>TextField;
        
        <span class="asBracket">[</span>Embed<span class="asBracket">(</span>source<span class="asOperator">=</span><span class="asString">&quot;/embed/fonts.swf&quot;</span>,symbol<span class="asOperator">=</span><span class="asString">&quot;Myriad Pro&quot;</span><span class="asBracket">)]</span>
        <span class="asReserved">private</span> <span class="asVar">var</span> MyriadPro<span class="asOperator">:</span>Class;
        
        <span class="asBracket">[</span>Embed<span class="asBracket">(</span>source<span class="asOperator">=</span><span class="asString">&quot;/embed/fonts.swf&quot;</span>,symbol<span class="asOperator">=</span><span class="asString">&quot;Myriad Pro Bold&quot;</span><span class="asBracket">)]</span>
        <span class="asReserved">private</span> <span class="asVar">var</span> MyriadProBold<span class="asOperator">:</span>Class;
        
        <span class="asReserved">public</span> <span class="asFunction">function</span> EmbeddedFonts<span class="asBracket">()</span> <span class="asBracket">{</span>
            <span class="asVar">var</span> main<span class="asOperator">:</span>Object <span class="asOperator">=</span> <span class="asReserved">new</span> Object<span class="asBracket">()</span>;
            main.fontSize <span class="asOperator">=</span> 30;
            main.letterSpacing <span class="asOperator">=</span> 8;
            main.textAlign <span class="asOperator">=</span> <span class="asString">&quot;center&quot;</span>;
            main.color <span class="asOperator">=</span> <span class="asString">&quot;#FFFFFF&quot;</span>;
            main.fontFamily <span class="asOperator">=</span> <span class="asString">&quot;Myriad Pro&quot;</span>;
            
            <span class="asVar">var</span> main_bold<span class="asOperator">:</span>Object <span class="asOperator">=</span> <span class="asReserved">new</span> Object<span class="asBracket">()</span>;
            main_bold.fontSize <span class="asOperator">=</span> 30;
            main_bold.letterSpacing <span class="asOperator">=</span> 8;
            main_bold.textAlign <span class="asOperator">=</span> <span class="asString">&quot;center&quot;</span>;
            main_bold.color <span class="asOperator">=</span> <span class="asString">&quot;#000000&quot;</span>;
            main_bold.fontFamily <span class="asOperator">=</span> <span class="asString">&quot;Myriad Pro Bold&quot;</span>;
            
            _style <span class="asOperator">=</span> <span class="asReserved">new</span> StyleSheet<span class="asBracket">()</span>;
            _style.setStyle<span class="asBracket">(</span><span class="asString">&quot;.main&quot;</span>, main<span class="asBracket">)</span>;
            _style.setStyle<span class="asBracket">(</span><span class="asString">&quot;.main_bold&quot;</span>, main_bold<span class="asBracket">)</span>;
            
            _copy <span class="asOperator">=</span> <span class="asReserved">new</span> TextField<span class="asBracket">()</span>;
            addChild<span class="asBracket">(</span>_copy<span class="asBracket">)</span>;
            _copy.autoSize <span class="asOperator">=</span> TextFieldAutoSize.LEFT;
            _copy.embedFonts <span class="asOperator">=</span> <span class="asReserved">true</span>;
            _copy.selectable <span class="asOperator">=</span> <span class="asReserved">false</span>;
            _copy.mouseWheelEnabled <span class="asOperator">=</span> <span class="asReserved">false</span>;
            _copy.styleSheet <span class="asOperator">=</span> _style;
            _copy.htmlText <span class="asOperator">=</span> <span class="asString">&quot;&lt;span class=&apos;main&apos;&gt;I &lt;/span&gt;&lt;span class=&apos;main_bold&apos;&gt;LIKE &lt;/span&gt;&lt;span class=&apos;main&apos;&gt;MONKEYS!&lt;/span&gt;&quot;</span>;
            _copy.x <span class="asOperator">=</span> 450<span class="asOperator">/</span>2 <span class="asOperator">-</span> _copy.textWidth<span class="asOperator">/</span>2;
            _copy.y <span class="asOperator">=</span> 60<span class="asOperator">/</span>2 <span class="asOperator">-</span> _copy.height<span class="asOperator">/</span>2;
        <span class="asBracket">}</span>
    <span class="asBracket">}</span>
<span class="asBracket">}</span>
</pre>

9) And voila.<br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
		id="EmbeddedFonts" width="450" height="60"
		codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
		<param name="movie" value="/wp-content/uploads/2008/05/EmbeddedFonts.swf" />
		<param name="quality" value="high" />
		<param name="bgcolor" value="#cccccc" />
		<param name="allowScriptAccess" value="sameDomain" />
		<embed src="/wp-content/uploads/2008/05/EmbeddedFonts.swf" quality="high" bgcolor="#cccccc"
			width="450" height="60" name="EmbeddedFonts" align="middle"
			play="true"
			loop="false"
			quality="high"
			allowScriptAccess="sameDomain"
			type="application/x-shockwave-flash"
			pluginspage="http://www.adobe.com/go/getflashplayer">
		</embed>
</object>]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		</item>
		<item>
		<title>The dropTarget conspiracy</title>
		<link>http://www.pmko.net/flash/the-droptarget-conspiracy/</link>
		<comments></comments>
		<pubDate>Thu, 08 May 2008 06:00:24 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
		<category><![CDATA[code example]]></category>

		<category><![CDATA[ActionScript 3]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">/flash/the-droptarget-conspiracy/</guid>
		<description><![CDATA[While working on an application that has some drag and drop functionality, I noticed something very interesting about the dropTarget property of the Sprite class.  It seems that the dropTarget returns the DisplayObject that is at the bottom of the display list which may not yield the result you are expecting.  I added [...]]]></description>
			<content:encoded><![CDATA[While working on an application that has some drag and drop functionality, I noticed something very interesting about the <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Sprite.html#dropTarget" target="_blank">dropTarget</a> property of the Sprite class.  It seems that the dropTarget returns the DisplayObject that is at the bottom of the display list which may not yield the result you are expecting.  I added a MouseEvent.MOUSE_MOVE event listener to the Sprite being dragged and traced out the dropTarget to see what kind of result I would get.
<br /><br />
Instead of seeing the names of Sprite instances that were set-up on the timeline, the trace output was nothing but generic names such as instance42.  The reason for this is that the object at the very bottom of the display list is not the Sprite that was created, but the contents of that Sprite such as a Shape or Bitmap.  It seems that the Flash Player automatically creates a DisplayObject for these internal Sprite elements and assigns them a unique instance name.  Tracing out the dropTarget.parent then reveals the DisplayObject that we're looking for.  One thing to note is that a Sprite that only has visual elements that were created with the drawing API will not exhibit this behavior.
<br /><br />
There are a couple of other things to be aware of when using the dropTarget.  First, setting the mouseEnabled or mouseChildren properties to false will not keep a DisplayObject from being assigned to the dropTarget property.  Second, depth has no effect on the assignment of a DisplayObject to the dropTarget propery.  Objects at a higher depth than the object being dragged will react the same way as those that are under it.  Third and probably the most important is that the assignment of the value for the dropTarget property is that of the DisplayObject that is directly under the mouse and has nothing to do with the bounding box of the DisplayObject being dragged.  Lastly, there are definitely situations where the dropTarget will be null, so be sure to check for that before trying to access properties of the dropTarget or you'll get everyone's favorite error - TypeError: Error #1009: Cannot access a property or method of a null object reference.
<br /><br />
example:
<pre>
import flash.events.MouseEvent;
import flash.display.Sprite;

dragee.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownHandler);
dragee.addEventListener(MouseEvent.MOUSE_UP,mouseUpHandler);
addEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandler);

function mouseDownHandler(evt:MouseEvent):void {
    dragee.startDrag();
}

function mouseUpHandler(evt:MouseEvent):void {
    dragee.stopDrag();
}

function mouseMoveHandler(evt:MouseEvent):void {
    if (dragee.dropTarget!=null) trace(dragee.dropTarget.name);
}</pre>
May the Null Object be your Friend.]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		</item>
		<item>
		<title>Losing scope within a class</title>
		<link>http://www.pmko.net/flash/losing-scope-within-a-class/</link>
		<comments></comments>
		<pubDate>Wed, 30 Apr 2008 22:34:09 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
		<category><![CDATA[code example]]></category>

		<category><![CDATA[ActionScript 2]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">/flash/losing-scope-within-a-class/</guid>
		<description><![CDATA[Maintaining scope while writing object orientated code in Flash isn&#8217;t always easy.  Let&#8217;s say you are loading some XML within a method in a class as in the following example:

class ExampleClass {
  var xml:XML;

  public function ExampleClass() {
    xml = new XML();
    xml.load(data.xml);
  }
}
When the [...]]]></description>
			<content:encoded><![CDATA[Maintaining scope while writing object orientated code in Flash isn't always easy.  Let's say you are loading some XML within a method in a class as in the following example:
<pre>
class ExampleClass {
  var xml:XML;

  public function ExampleClass() {
    xml = new XML();
    xml.load(data.xml);
  }
}</pre>
When the XML is done loading it is handled by a method on the XML class that the developer is meant to define such as:
<pre>
xml.onLoad = function { // do something with the XML. }</pre>
Well, what if you want to do something within the context of the compositing class (ExampleClass) at this point.  Any code that you put within the onLoad function definition will execute within the scope of the XML object and not your class.  The XML object also has no reference to the parent class like a MovieClip does and you can not dynamically add properties to the XML object like a MovieClip either which would allow you to make an internal reference to the compositing class.
<br /><br />
Fortunately Flash provides a really cool component for maintaining scope.  Most developers don't even know this exists because it is a component and not listed with the main ActionScript Classes. The <a href="http://livedocs.adobe.com/flash/8/main/00003430.html" target="blank">mx.utils.Delegate</a> class will allow you to define the onLoad function, but within the scope of whatever object you specify.  Let's see an example:
<pre>
import mx.utils.Delegate;
class ExampleClass {
  var xml:XML;

  public function ExampleClass() {
    xml = new XML();
    xml.onLoad = Delegate.create(this,onXMLLoad);
    xml.load(data.xml);
  }

  private function onXMLLoad(success:Boolean):void {
    // this code will now execute within the scope
    // of the ExampleClass class.
  }
}</pre>
This works great in a variety of situations such as:<br />
- adding event listeners<br />
- defining event handlers like onRelease on child MovieClips of a class<br />
- LoadVars<br />
- NetStream
<br /><br />
This is no longer a problem in AS3 because scope is automatically remembered which makes life a lot easier.  Once you start using the Delegate class, you'll never know how you got along with out it.]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		</item>
		<item>
		<title>Sharing your content with Facebook</title>
		<link>http://www.pmko.net/html-javascript/sharing-your-content-with-facebook/</link>
		<comments></comments>
		<pubDate>Thu, 28 Feb 2008 18:39:20 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
		<category><![CDATA[Facebook]]></category>

		<category><![CDATA[HTML/JavaScript]]></category>

		<guid isPermaLink="false">/html-javascript/sharing-your-content-with-facebook/</guid>
		<description><![CDATA[Facebook provides a really easy way to get your content into a Facebook user&#8217;s Mini-Feed.  Basically you use a link to Facebook&#8217;s share partner page and provide as a url param a link to your content.  When a Facebook user click&#8217;s the link provided by you, Facebook scrapes the HTML of the page [...]]]></description>
			<content:encoded><![CDATA[Facebook provides a really easy way to get your content into a Facebook user's Mini-Feed.  Basically you use a link to Facebook's share partner page and provide as a url param a link to your content.  When a Facebook user click's the link provided by you, Facebook scrapes the HTML of the page provided in the link and creates the content for a Mini-Feed line item or a message to send to another Facebook user.
<br /><br />
The downside of this is that the user can change the title and message body, pick between 0-3 auto picked images and comment on it.  This leaves a lot of room for a negative impact on your content, but even with this possibility a lot of the brands that I work with are doing it.  The key to making this work is to create specialized HTML pages that have only the content you want to share.
<br /><br />
To see this in action and share this blog, click on the Facebook Share badge.
<br />
<script>function fbs_click() {u="http://www.pmko.net/facebook_share/index.html";t="Professional Monkey Keyboard Operator";window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><style> .fb_share_link { padding:2px 0 0 20px; height:16px; color: #3b5998;background:url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?57:26981) no-repeat top left; }</style><a href="http://www.facebook.com/share.php?u=<url>" onclick="return fbs_click()" target="_blank" class="fb_share_link">Share on Facebook</a>
<br /><br />
Check out <a href="http://www.facebook.com/share_partners.php" target="_blank">Facebook's Share Partners</a> page for the code.  And be sure to click on the "How do I make sure the Share Preview works?" link at the bottom of the page to see how to structure the HTML for your content page.]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		</item>
		<item>
		<title>Judging the Interactive Media Awards</title>
		<link>http://www.pmko.net/interactive/judging-the-interactive-media-awards/</link>
		<comments></comments>
		<pubDate>Wed, 20 Feb 2008 07:55:14 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
		<category><![CDATA[Interactive]]></category>

		<guid isPermaLink="false">/interactive/judging-the-interactive-media-awards/</guid>
		<description><![CDATA[Today I was informed that I have been chosen to be a judge for the Interactive Media Awards.  Being a judge in an interactive competition is one of many things that I&#8217;ve wanted to do during my career along with getting published in a magazine, speaking at a conference, winning awards, starting an open [...]]]></description>
			<content:encoded><![CDATA[<img src="/wp-content/uploads/2008/02/IMA-logo.jpg" alt="Do It" align="left" hspace="5" vspace="5" />Today I was informed that I have been chosen to be a <a href="http://www.interactivemediaawards.com/judges/" target="_blank">judge for the Interactive Media Awards</a>.  Being a judge in an interactive competition is one of many things that I've wanted to do during my career along with getting published in a magazine, speaking at a conference, winning awards, starting an open source project and writing a book.  Hopefully I'll have the opportunity to do some of these more than once, but for now I've got three down and three to go.  The best part of this opportunity is the ability to give back to the community, which is also why I write this blog.  I've learned so much over the last 12 years from others who were willing to share their experience and knowledge, it's my pleasure to give something back.
<br /><br />
The <a href="http://www.interactivemediaawards.com/enter/" target="_blank">2008 Call for Entries</a> is still open until March 31, so grab the bull by the horns and submit your work.]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		</item>
		<item>
		<title>Remoting for everyone</title>
		<link>http://www.pmko.net/flash/remoting-for-everyone/</link>
		<comments></comments>
		<pubDate>Tue, 12 Feb 2008 06:43:37 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
		<category><![CDATA[Remoting]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">/flash/remoting-for-everyone/</guid>
		<description><![CDATA[Adobe opens up Flash Remoting (aka BlaszeDS) and the AMF protocol.  How awesome is that?  I&#8217;ve been a long time Remoting user and think it&#8217;s the best way to go when you need data from a server.  Although Adobe&#8217;s offering is Java based, there are some really good PHP, .Net and other [...]]]></description>
			<content:encoded><![CDATA[Adobe opens up Flash Remoting (aka <a href="http://labs.adobe.com/technologies/blazeds/" target="_blank">BlaszeDS</a>) and the AMF protocol.  How awesome is that?  I've been a long time Remoting user and think it's the best way to go when you need data from a server.  Although Adobe's offering is Java based, there are some really good PHP, .Net and other distributions.  For more information on these check out <a href="http://www.themidnightcoders.com/" target="_blank">The MidnightCoders</a>, <a href="http://www.amfphp.org/" target="_blank">AMFPHP</a> and <a href="http://sourceforge.net/projects/openamf/" target="_blank">OpenAMF</a>.]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		</item>
		<item>
		<title>Dispatching events between AS2 and AS3</title>
		<link>http://www.pmko.net/flash/dispatching-events-between-as2-and-as3/</link>
		<comments></comments>
		<pubDate>Wed, 06 Feb 2008 07:54:27 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
		<category><![CDATA[code example]]></category>

		<category><![CDATA[ActionScript 2]]></category>

		<category><![CDATA[ActionScript 3]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">/flash/dispatching-events-between-as2-and-as3/</guid>
		<description><![CDATA[Even though AS3 has been out for some time now, there are still situations when you will need to load an AS2 compiled SWF into an AS3 compiled SWF and communicate with it.  A good example would be if you need to use the ActionSource component for Omniture tracking or some other AS2 based [...]]]></description>
			<content:encoded><![CDATA[Even though AS3 has been out for some time now, there are still situations when you will need to load an AS2 compiled SWF into an AS3 compiled SWF and communicate with it.  A good example would be if you need to use the ActionSource component for Omniture tracking or some other AS2 based Flash component in a Flash 9 or Flex 2 project.  Well, what if you could simply dispatch an event and listen for it on the other side?  That's what ASBridge does.
<br /><br />
ASBridge consists of 4 classes, ASBridge and ASBridgeEvent classes for both AS2 (<em>cookiejar</em> package) and AS3 (<em>sugarcookie</em> package).  The core idea of ASBridge comes from the <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/LocalConnection.html" target="_blank">Adobe LiveDocs LocalConnection entry</a>, check out the second paragraph where it says that AS 1,2, and 3 can communicate with each other using a LocalConnection, that's where the magic is.  Only thing to really be aware of is the 40kb limit on the amount of data that can be passed as <em>arguments</em> to the <em>send()</em> method.
<br /><br />
Displayed below is the source code for the ASBridge_Example class which is the main class for the AS3 Project and the AS2_ASBridge class used in the Flash 8 Fla with brief descriptions.  To get all the source code including the ASBridge classes for both AS2 and AS3, <a href="/wp-content/downloads/ASBridge_Example.zip">download all the source as an Eclipse ActionScript 3 Project</a>.  
<br /><br />
To use the ActionScript 3 Project zip:<br/ >
- unzip file anywhere<br />
- open Eclipse<br />
- File -> Import, choose <em>Existing Projects into Workspace</em> and click <em>next</em><br />
- <em>browse</em> for the root of the extracted directory<br />
- click <em>Finish</em>
<p>
<strong>ASBridge_Example</strong><br />
Demonstrates loading a AS2 SWF into an ActionScript 3 Project generated SWF and using ASBridge to send and receive events with data between AS3 and AS2.
<br />
<pre><span class="asPackage">package</span> <span class="asBracket">{</span>
    <span class="asReserved">import</span> com.sugarcookie.adapter.ASBridge;
    <span class="asReserved">import</span> com.sugarcookie.adapter.events.ASBridgeEvent;
    
    <span class="asReserved">import</span> flash.display.Loader;
    <span class="asReserved">import</span> flash.display.Sprite;
    <span class="asReserved">import</span> flash.events.Event;
    <span class="asReserved">import</span> flash.net.URLRequest;

    <span class="asReserved">public</span> <span class="asClass">class</span> ASBridge_Example <span class="asReserved">extends</span> Sprite <span class="asBracket">{</span>
        <span class="asReserved">private</span> <span class="asVar">var</span> _adapter<span class="asOperator">:</span>ASBridge;
        <span class="asReserved">private</span> <span class="asVar">var</span> _loader<span class="asOperator">:</span>Loader;
        
        <span class="asReserved">public</span> <span class="asFunction">function</span> ASBridge_Example<span class="asBracket">()</span> <span class="asBracket">{</span>
            _adapter <span class="asOperator">=</span> ASBridge.getInst<span class="asBracket">()</span>;
            _adapter.addEventListener<span class="asBracket">(</span><span class="asString">&quot;onAdapterReady&quot;</span>,onAdapterReady<span class="asBracket">)</span>;
            
            _loader <span class="asOperator">=</span> <span class="asReserved">new</span> Loader<span class="asBracket">()</span>;
            _loader.contentLoaderInfo.addEventListener<span class="asBracket">(</span>Event.COMPLETE, onLoadComplete<span class="asBracket">)</span>;
             <span class="asVar">var</span> request<span class="asOperator">:</span>URLRequest <span class="asOperator">=</span> <span class="asReserved">new</span> URLRequest<span class="asBracket">(</span><span class="asString">&quot;AS2_ASBridge.swf&quot;</span><span class="asBracket">)</span>;
            _loader.load<span class="asBracket">(</span>request<span class="asBracket">)</span>;

            addChild<span class="asBracket">(</span>_loader<span class="asBracket">)</span>;
        <span class="asBracket">}</span>
        
        <span class="asReserved">private</span> <span class="asFunction">function</span> onLoadComplete<span class="asBracket">(</span>evt<span class="asOperator">:</span>Event<span class="asBracket">)</span><span class="asOperator">:</span><span class="asReserved">void</span> <span class="asBracket">{</span>
            <span class="asTrace">trace</span><span class="asBracket">(</span><span class="asString">&quot;onLoadComplete: &quot;</span><span class="asOperator">+</span>evt.toString<span class="asBracket">())</span>;
        <span class="asBracket">}</span>
        
        <span class="asReserved">private</span> <span class="asFunction">function</span> onAdapterReady<span class="asBracket">(</span>evt<span class="asOperator">:</span>ASBridgeEvent<span class="asBracket">)</span><span class="asOperator">:</span><span class="asReserved">void</span> <span class="asBracket">{</span>
            <span class="asTrace">trace</span><span class="asBracket">(</span><span class="asString">&quot;successfully received event with data from AS2&quot;</span><span class="asBracket">)</span>;
            <span class="asTrace">trace</span><span class="asBracket">(</span><span class="asString">&quot;onAdapterReady: &quot;</span><span class="asOperator">+</span>evt.toString<span class="asBracket">())</span>;
            _adapter.sendEvent<span class="asBracket">(</span><span class="asString">&quot;onBridgeComm&quot;</span>,<span class="asBracket">{</span>id<span class="asOperator">:</span><span class="asString">&quot;test data&quot;</span><span class="asBracket">})</span>;
        <span class="asBracket">}</span>
    <span class="asBracket">}</span>
<span class="asBracket">}</span>
</pre>
<br />
<strong>AS2_ASBridge</strong><br />
Demonstrates sending and receiving events with data between AS2 and AS3 implemented as a class that is instantiated on the timeline of a Flash 8 Fla.
<br />
<pre><span class="asReserved">import</span> com.cookiejar.adapter.ASBridge;
<span class="asReserved">import</span> com.cookiejar.adapter.events.ASBridgeEvent;

<span class="asClass">class</span> AS2_ASBridge <span class="asBracket">{</span>
    <span class="asReserved">private</span> <span class="asVar">var</span> _adapter<span class="asOperator">:</span>ASBridge;
    
    <span class="asReserved">public</span> <span class="asFunction">function</span> AS2_ASBridge<span class="asBracket">()</span> <span class="asBracket">{</span>
        _adapter <span class="asOperator">=</span> ASBridge.getInst<span class="asBracket">()</span>;
        _adapter.addEventListener<span class="asBracket">(</span><span class="asString">&quot;onBridgeComm&quot;</span>,<span class="asReserved">this</span><span class="asBracket">)</span>;
        _adapter.sendEvent<span class="asBracket">(</span><span class="asString">&quot;onAdapterReady&quot;</span>,<span class="asBracket">{</span>status<span class="asOperator">:</span><span class="asReserved">true</span><span class="asBracket">})</span>;
    <span class="asBracket">}</span>
    
    <span class="asReserved">private</span> <span class="asFunction">function</span> onBridgeComm<span class="asBracket">(</span>evt<span class="asOperator">:</span>ASBridgeEvent<span class="asBracket">)</span><span class="asOperator">:</span>Void <span class="asBracket">{</span>
        <span class="asTrace">trace</span><span class="asBracket">(</span><span class="asString">&quot;successfully received event with data from AS3&quot;</span><span class="asBracket">)</span>;
    <span class="asBracket">}</span>
<span class="asBracket">}</span></pre>]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		</item>
		<item>
		<title>Stickies deleted my To Do listNow I use Do It</title>
		<link>http://www.pmko.net/mac-os-x/stickies-deleted-my-to-do-list-now-i-use-do-it/</link>
		<comments></comments>
		<pubDate>Tue, 22 Jan 2008 08:25:31 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">/mac-os-x/stickies-deleted-my-to-do-list-now-i-use-do-it/</guid>
		<description><![CDATA[I have used Stickies to manage my multiple To Do lists for awhile now until the other day when I restarted my laptop and the Stickies database was magically cleared out.  Apparently this happens more than you would think because I found lots of discussion about it online.  With Stickies there are no [...]]]></description>
			<content:encoded><![CDATA[<img src="/wp-content/uploads/2008/02/DoIt.jpg" alt="Do It" align="left" hspace="5" vspace="5" />I have used Stickies to manage my multiple To Do lists for awhile now until the other day when I restarted my laptop and the Stickies database was magically cleared out.  Apparently this happens more than you would think because I found lots of discussion about it online.  With Stickies there are no backups unless you make them yourself, which I had not of course, so I was out of luck.  You're only options are to write a shell or <a href="http://www.apple.com/applescript/" target="_blank">applescript</a> script to do rotating backups, but that's a pain in the ass.
<br /><br />
Luckily there are people in the world that write really cool free software, although you can donate to the cause if you like.  <a href="http://www.jimmcgowan.net/Site/DoIt.html" target="_blank">Do IT</a> is a really amazing list organizing application that will also backup your data as an XML file.  It's such a great little program I would put it in the same class as <a href="http://www.adiumx.com/" target="_blank">Adium</a> and <a href="http://cyberduck.ch/" target="_blank">Cyberduck</a>, both of which are favorites of mine.]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		</item>
		<item>
		<title>My first published article</title>
		<link>http://www.pmko.net/interactive/my-first-published-article/</link>
		<comments></comments>
		<pubDate>Fri, 11 Jan 2008 05:39:28 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[Interactive]]></category>

		<guid isPermaLink="false">/interactive/my-first-published-article/</guid>
		<description><![CDATA[Writing a blog is cool, but getting an article into print is better.  My first article, &#8220;Sliverlight Is No Flash Killer&#8221; was published in the August/September issue of Streaming Media Magazine as the last page article.  I was pretty happy to get that position in the magazine as I always find those articles [...]]]></description>
			<content:encoded><![CDATA[<img src="/wp-content/uploads/2008/01/streaming_media_cover.jpg" alt="Streaming Media Magazing - August/September Issue" align="left" hspace="5" vspace="5" />Writing a blog is cool, but getting an article into print is better.  My first article, "Sliverlight Is No Flash Killer" was published in the <a href="http://www.nxtbook.com/nxtbooks/streamingmedia/0807/index.php?startpage=105" target="_blank">August/September issue of Streaming Media Magazine</a> as the last page article.  I was pretty happy to get that position in the magazine as I always find those articles the most interesting.  
<br /><br />
I'm currently working on my second article so stayed tuned...]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		</item>
	</channel>
</rss>
