<?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: AS3 &#8211; custom event classes or inspectable properties</title>
	<atom:link href="http://www.cruciallimit.com/blog/82/as3-custom-event-classes-or-inspectable-properties/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cruciallimit.com/blog/82/as3-custom-event-classes-or-inspectable-properties/</link>
	<description>Rants and Commentary about Flash/WebDesign/Motion Graphics by Crucial Limit</description>
	<lastBuildDate>Sat, 31 Jul 2010 00:07:16 -0700</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
	<item>
		<title>By: Joony</title>
		<link>http://www.cruciallimit.com/blog/82/as3-custom-event-classes-or-inspectable-properties/comment-page-1/#comment-75333</link>
		<dc:creator>Joony</dc:creator>
		<pubDate>Tue, 28 Oct 2008 22:32:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.cruciallimit.com/blog/?p=82#comment-75333</guid>
		<description>I don&#039;t think there is one all encompassing &quot;best method.&quot;  Different problems warrant different solution, and even then there are many different solutions to any one problem.

For the most part thought, I agree with Alex in the first comment.  If your object dispatches a custom event it can create a DTO which contains only the information relevant to that event and pass that along with it.  Multiple listeners can pick up the DTO and do whatever.  This way they leave the dispatching object alone.

It may seem like more work to some people but it&#039;s better design in my opinion, but as I stated above it&#039;s not the definitive answer.

I might write a bit in my blog about custom events and DTOs if anyone is interested.

Joony</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think there is one all encompassing &#8220;best method.&#8221;  Different problems warrant different solution, and even then there are many different solutions to any one problem.</p>
<p>For the most part thought, I agree with Alex in the first comment.  If your object dispatches a custom event it can create a DTO which contains only the information relevant to that event and pass that along with it.  Multiple listeners can pick up the DTO and do whatever.  This way they leave the dispatching object alone.</p>
<p>It may seem like more work to some people but it&#8217;s better design in my opinion, but as I stated above it&#8217;s not the definitive answer.</p>
<p>I might write a bit in my blog about custom events and DTOs if anyone is interested.</p>
<p>Joony</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam Dean</title>
		<link>http://www.cruciallimit.com/blog/82/as3-custom-event-classes-or-inspectable-properties/comment-page-1/#comment-73483</link>
		<dc:creator>Sam Dean</dc:creator>
		<pubDate>Thu, 09 Oct 2008 22:00:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.cruciallimit.com/blog/?p=82#comment-73483</guid>
		<description>Hi Dave,

Personally, I usually like to create an event with all the needed properties in it, I then only make getter methods so the properties are read-only - this reminds me not to try anything clever with them :) - (the properties get initialized in the Event&#039;s constructor).

Having the event be read-only makes your objects less coupled, which is a Good Thing. However, it sometimes means that you spend ages creating events with lots of properties that just mirror the object that sent it, which is a Waste Of Time.

All in all, I&#039;m still fairly undecided and play it by ear, if the event sending object wants to be updated because of the event I just use the reference, otherwise I have the relevant properties in my custom event.

If you ever find out the best method to use, please let me know!


Sam.</description>
		<content:encoded><![CDATA[<p>Hi Dave,</p>
<p>Personally, I usually like to create an event with all the needed properties in it, I then only make getter methods so the properties are read-only &#8211; this reminds me not to try anything clever with them <img src='http://www.cruciallimit.com/blog/smilies/yahoo_smiley.gif' alt='&#58;&#41;' class='wp-smiley' width='18' height='18' title='&#58;&#41;' /> &#8211; (the properties get initialized in the Event&#8217;s constructor).</p>
<p>Having the event be read-only makes your objects less coupled, which is a Good Thing. However, it sometimes means that you spend ages creating events with lots of properties that just mirror the object that sent it, which is a Waste Of Time.</p>
<p>All in all, I&#8217;m still fairly undecided and play it by ear, if the event sending object wants to be updated because of the event I just use the reference, otherwise I have the relevant properties in my custom event.</p>
<p>If you ever find out the best method to use, please let me know!</p>
<p>Sam.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Crucial</title>
		<link>http://www.cruciallimit.com/blog/82/as3-custom-event-classes-or-inspectable-properties/comment-page-1/#comment-67670</link>
		<dc:creator>Crucial</dc:creator>
		<pubDate>Mon, 14 Jul 2008 22:20:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.cruciallimit.com/blog/?p=82#comment-67670</guid>
		<description>@tupakapoor you can reference the target by inspecting the target property of the event object. for example, in your listener method you could do something like:
&lt;code&gt;private function myListener(evt:Event):void {
     trace(&quot;The object that dispatched this event is &quot; + evt.target)
}&lt;/code&gt;

Hope that helps,
-Dave</description>
		<content:encoded><![CDATA[<p>@tupakapoor you can reference the target by inspecting the target property of the event object. for example, in your listener method you could do something like:<br />
<code>private function myListener(evt:Event):void {<br />
     trace("The object that dispatched this event is " + evt.target)<br />
}</code></p>
<p>Hope that helps,<br />
-Dave</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tupakapoor</title>
		<link>http://www.cruciallimit.com/blog/82/as3-custom-event-classes-or-inspectable-properties/comment-page-1/#comment-67663</link>
		<dc:creator>tupakapoor</dc:creator>
		<pubDate>Mon, 14 Jul 2008 22:00:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.cruciallimit.com/blog/?p=82#comment-67663</guid>
		<description>Can you give an example of how you would reference the original object that dispatched the event? A global variable will not work for me in this instance as I could be dispatching multiple events, each time overwriting the global variable. Is &quot;parent&quot; a valid member of an Event object?</description>
		<content:encoded><![CDATA[<p>Can you give an example of how you would reference the original object that dispatched the event? A global variable will not work for me in this instance as I could be dispatching multiple events, each time overwriting the global variable. Is &#8220;parent&#8221; a valid member of an Event object?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Crucial</title>
		<link>http://www.cruciallimit.com/blog/82/as3-custom-event-classes-or-inspectable-properties/comment-page-1/#comment-53311</link>
		<dc:creator>Crucial</dc:creator>
		<pubDate>Sat, 19 Jan 2008 00:27:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.cruciallimit.com/blog/?p=82#comment-53311</guid>
		<description>&lt;p&gt;@Ben - Hard to say without an fla but you can still reference &lt;em&gt;parent&lt;/em&gt; (just no underscore with AS3) to advance a counter variable stored inside the MovieClip that houses the bubbles. It&#039;s also worth mentioning that not everything HAS to be called from the main timeline, you can still have scripts on nested timelines as you have always done. The only real change there is syntax. Hope that helps.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Ben &#8211; Hard to say without an fla but you can still reference <em>parent</em> (just no underscore with AS3) to advance a counter variable stored inside the MovieClip that houses the bubbles. It&#8217;s also worth mentioning that not everything HAS to be called from the main timeline, you can still have scripts on nested timelines as you have always done. The only real change there is syntax. Hope that helps.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
