<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Using EventDispatcher in AS2, the AS3 way</title>
	<atom:link href="http://www.sakri.net/blog/2007/02/20/using-eventdispatcher-in-as2-the-as3-way/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sakri.net/blog/2007/02/20/using-eventdispatcher-in-as2-the-as3-way/</link>
	<description>I Flash und I Flex Jaaaa</description>
	<lastBuildDate>Fri, 28 Oct 2011 05:36:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: sakri</title>
		<link>http://www.sakri.net/blog/2007/02/20/using-eventdispatcher-in-as2-the-as3-way/#comment-1615</link>
		<dc:creator>sakri</dc:creator>
		<pubDate>Tue, 30 Nov 2010 11:19:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakri.net/blog/?p=4#comment-1615</guid>
		<description>Hi Franky! 

This post is almost 4 years old so forgive me if I&#039;m forgetful...  The magic happens in this line : EventDispatcher.initialize(this);  This is inbuilt AS2 functionality, it basically &quot;hijacks&quot; your class and overrides those empty functions you see in the code snippet.

I really don&#039;t know if you have to wait a frame or not.

Also the addListener syntax... check how AS2 components do it, I&#039;m guessing this works the same way. I really do feel the pain you must be going through in having to write as2 ;)

Good luck!</description>
		<content:encoded><![CDATA[<p>Hi Franky! </p>
<p>This post is almost 4 years old so forgive me if I&#8217;m forgetful&#8230;  The magic happens in this line : EventDispatcher.initialize(this);  This is inbuilt AS2 functionality, it basically &#8220;hijacks&#8221; your class and overrides those empty functions you see in the code snippet.</p>
<p>I really don&#8217;t know if you have to wait a frame or not.</p>
<p>Also the addListener syntax&#8230; check how AS2 components do it, I&#8217;m guessing this works the same way. I really do feel the pain you must be going through in having to write as2 <img src='http://www.sakri.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Good luck!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Franky</title>
		<link>http://www.sakri.net/blog/2007/02/20/using-eventdispatcher-in-as2-the-as3-way/#comment-1614</link>
		<dc:creator>Franky</dc:creator>
		<pubDate>Tue, 30 Nov 2010 10:56:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakri.net/blog/?p=4#comment-1614</guid>
		<description>If you dispatch an event by dispatchEvent(new Event(&quot;something_sweet&quot;)); ... how would you listen to it ??

addEventListener( ?? , functionToHandle??)
And do you have to set the listener a frame after instantiating a class????

Can somebody help me please?</description>
		<content:encoded><![CDATA[<p>If you dispatch an event by dispatchEvent(new Event(&#8220;something_sweet&#8221;)); &#8230; how would you listen to it ??</p>
<p>addEventListener( ?? , functionToHandle??)<br />
And do you have to set the listener a frame after instantiating a class????</p>
<p>Can somebody help me please?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matt</title>
		<link>http://www.sakri.net/blog/2007/02/20/using-eventdispatcher-in-as2-the-as3-way/#comment-1237</link>
		<dc:creator>matt</dc:creator>
		<pubDate>Wed, 22 Jul 2009 14:44:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakri.net/blog/?p=4#comment-1237</guid>
		<description>going through similar as2 retrospective hell - don&#039;t forget if you&#039;re using an EventDispatchingMovieClip class and the clips are laid out on the stage you have to wait a frame before adding event listeners so the clip&#039;s EventDispatching properties have time to be  initialised. ugh!</description>
		<content:encoded><![CDATA[<p>going through similar as2 retrospective hell &#8211; don&#8217;t forget if you&#8217;re using an EventDispatchingMovieClip class and the clips are laid out on the stage you have to wait a frame before adding event listeners so the clip&#8217;s EventDispatching properties have time to be  initialised. ugh!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: obie</title>
		<link>http://www.sakri.net/blog/2007/02/20/using-eventdispatcher-in-as2-the-as3-way/#comment-550</link>
		<dc:creator>obie</dc:creator>
		<pubDate>Tue, 19 Aug 2008 09:15:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakri.net/blog/?p=4#comment-550</guid>
		<description>hmmm - when i use this the _target never gets set in the event (NOTE: there was a typo in the constructor where the leading _ on _target was left out but that wasn&#039;t my problem)</description>
		<content:encoded><![CDATA[<p>hmmm &#8211; when i use this the _target never gets set in the event (NOTE: there was a typo in the constructor where the leading _ on _target was left out but that wasn&#8217;t my problem)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio</title>
		<link>http://www.sakri.net/blog/2007/02/20/using-eventdispatcher-in-as2-the-as3-way/#comment-544</link>
		<dc:creator>Sergio</dc:creator>
		<pubDate>Fri, 01 Aug 2008 21:03:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakri.net/blog/?p=4#comment-544</guid>
		<description>So this looks like what I am trying to accomplish, but how would I use it?  Can you give a complete usage sample?  Say, to listen for a movieclip.onRollOver event?</description>
		<content:encoded><![CDATA[<p>So this looks like what I am trying to accomplish, but how would I use it?  Can you give a complete usage sample?  Say, to listen for a movieclip.onRollOver event?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.sakri.net/blog/2007/02/20/using-eventdispatcher-in-as2-the-as3-way/#comment-531</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Fri, 18 Jul 2008 02:48:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakri.net/blog/?p=4#comment-531</guid>
		<description>Nevermind! Silly question...don&#039;t know what I was thinking. I didn&#039;t think that I can just pass an object to the constructor!</description>
		<content:encoded><![CDATA[<p>Nevermind! Silly question&#8230;don&#8217;t know what I was thinking. I didn&#8217;t think that I can just pass an object to the constructor!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.sakri.net/blog/2007/02/20/using-eventdispatcher-in-as2-the-as3-way/#comment-530</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Fri, 18 Jul 2008 02:15:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakri.net/blog/?p=4#comment-530</guid>
		<description>Cheers for the class mate, very nice. It alleviates a lot of the bitchy aspects of the EventDispatcher.initialize(this) method that caused me much pain in the past. Anyhow, how would you propose I pass data along with the event? Should I make a custom event class as in AS3? Thanks again...</description>
		<content:encoded><![CDATA[<p>Cheers for the class mate, very nice. It alleviates a lot of the bitchy aspects of the EventDispatcher.initialize(this) method that caused me much pain in the past. Anyhow, how would you propose I pass data along with the event? Should I make a custom event class as in AS3? Thanks again&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthias</title>
		<link>http://www.sakri.net/blog/2007/02/20/using-eventdispatcher-in-as2-the-as3-way/#comment-511</link>
		<dc:creator>Matthias</dc:creator>
		<pubDate>Wed, 07 May 2008 13:03:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakri.net/blog/?p=4#comment-511</guid>
		<description>thank you!</description>
		<content:encoded><![CDATA[<p>thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sakri</title>
		<link>http://www.sakri.net/blog/2007/02/20/using-eventdispatcher-in-as2-the-as3-way/#comment-510</link>
		<dc:creator>sakri</dc:creator>
		<pubDate>Tue, 06 May 2008 15:16:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakri.net/blog/?p=4#comment-510</guid>
		<description>HI Mattias,

I guess you could extend MovieClip with a EventDispatchingMovieClip like so:

import mx.events.EventDispatcher;

class EventDispatchingMovieClip extends MovieClip{

     public function EventDispatchingMovieClip(){
         EventDispatcher.initialize(this);
     }

     public function dispatchEvent(){}
     public function addEventListener(){}
     public function removeEventListener(){}
}

(sorry about the formatting, I thought I had a code formatting plugin but it seems to be malfunctioning :(  ).


Then, whenever you need dispatching, instead of extending MovieClip, extend EventDispatchingMovieClip... Purists prefer composition over inheritance, but let&#039;s face it, this was a hack to begin with :D</description>
		<content:encoded><![CDATA[<p>HI Mattias,</p>
<p>I guess you could extend MovieClip with a EventDispatchingMovieClip like so:</p>
<p>import mx.events.EventDispatcher;</p>
<p>class EventDispatchingMovieClip extends MovieClip{</p>
<p>     public function EventDispatchingMovieClip(){<br />
         EventDispatcher.initialize(this);<br />
     }</p>
<p>     public function dispatchEvent(){}<br />
     public function addEventListener(){}<br />
     public function removeEventListener(){}<br />
}</p>
<p>(sorry about the formatting, I thought I had a code formatting plugin but it seems to be malfunctioning <img src='http://www.sakri.net/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />   ).</p>
<p>Then, whenever you need dispatching, instead of extending MovieClip, extend EventDispatchingMovieClip&#8230; Purists prefer composition over inheritance, but let&#8217;s face it, this was a hack to begin with <img src='http://www.sakri.net/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthias</title>
		<link>http://www.sakri.net/blog/2007/02/20/using-eventdispatcher-in-as2-the-as3-way/#comment-509</link>
		<dc:creator>Matthias</dc:creator>
		<pubDate>Tue, 06 May 2008 14:35:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.sakri.net/blog/?p=4#comment-509</guid>
		<description>but the clunky way to â€œshove inâ€ the code of EventDispatcher allowed us to shove it right into classes extending MovieClip. How can I use your attempt for that? In AS3 MovieClip already extends EventDispatcher, but in AS2 it does NOT. Any ideas?</description>
		<content:encoded><![CDATA[<p>but the clunky way to â€œshove inâ€ the code of EventDispatcher allowed us to shove it right into classes extending MovieClip. How can I use your attempt for that? In AS3 MovieClip already extends EventDispatcher, but in AS2 it does NOT. Any ideas?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

