<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Passing Arguments with Events</title>
	<link>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/</link>
	<description>A digital supplement for the O'Reilly book</description>
	<pubDate>Sat, 04 Feb 2012 06:16:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: How to Pass Additional Parameters to AS3 Event Handler Functions &#124; Photoshop Cs5 Tutorials</title>
		<link>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-19986</link>
		<dc:creator>How to Pass Additional Parameters to AS3 Event Handler Functions &#124; Photoshop Cs5 Tutorials</dc:creator>
		<pubDate>Sun, 07 Aug 2011 15:09:09 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-19986</guid>
		<description>[...] searching and found an article by Rich Schupe that explains a few different methods on how one can pass arguments with events in AS3. He focuses mainly on teaching the reader how to create a custom event class in order to address [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] searching and found an article by Rich Schupe that explains a few different methods on how one can pass arguments with events in AS3. He focuses mainly on teaching the reader how to create a custom event class in order to address [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flash Event Listeners Tutorials &#124; tutorials blogs</title>
		<link>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-17255</link>
		<dc:creator>Flash Event Listeners Tutorials &#124; tutorials blogs</dc:creator>
		<pubDate>Sat, 11 Jun 2011 16:06:02 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-17255</guid>
		<description>[...] EnterFrame EventListener &#124; Is Good Stuff Passing Arguments with Events at Learning ActionScript 3.0 Flashvalley &#8211; Flash tutorials &#8211; Mouse Events in Actionscript 3.0 ActionScript 3.0: how [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] EnterFrame EventListener | Is Good Stuff Passing Arguments with Events at Learning ActionScript 3.0 Flashvalley &#8211; Flash tutorials &#8211; Mouse Events in Actionscript 3.0 ActionScript 3.0: how [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: coderkind.com &#187; Tab links dump</title>
		<link>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-13182</link>
		<dc:creator>coderkind.com &#187; Tab links dump</dc:creator>
		<pubDate>Fri, 04 Mar 2011 11:26:19 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-13182</guid>
		<description>[...] across versions How -omit-trace-statements Works… Or Does NOT… Dispatching Custom Events Passing Arguments with Events RegExr The Event Meta Tag in Actionscript 3 and Flex Builder Singleton classes in AS3  Posted [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] across versions How -omit-trace-statements Works… Or Does NOT… Dispatching Custom Events Passing Arguments with Events RegExr The Event Meta Tag in Actionscript 3 and Flex Builder Singleton classes in AS3  Posted [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-5952</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Wed, 24 Feb 2010 15:44:53 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-5952</guid>
		<description>@Tino, thanks for posting!</description>
		<content:encoded><![CDATA[<p>@Tino, thanks for posting!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tino</title>
		<link>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-5890</link>
		<dc:creator>Tino</dc:creator>
		<pubDate>Thu, 18 Feb 2010 14:30:24 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-5890</guid>
		<description>Here is an approach I use when I want to pass arguments with events. It's kind of similar to Jonathon's, but I thought it worth posting. I find this useful for testing things and if I am in a rush and various other times!

Example 1.
This is when I want to bind activity to one particular event of one display object:

&lt;pre class="code"&gt;
btn.addEventListener(MouseEvent.CLICK, tempfn)
function tempfn(e:Event):void
{
	trace('btn title')
}
&lt;/pre&gt;

Example 2.

If you want to do this for more than one object..

Use a literal function (I think that's the right term). Any road, in the example below, when the user clicks on 'btn', or 'btn2', the statements within the function literal tempfn - declared as the function for the event - will fire.

&lt;pre class="code"&gt;
btn.addEventListener(MouseEvent.CLICK, function tempfn(e:Event):void{ trace('btn title') } )
btn2.addEventListener(MouseEvent.CLICK, function tempfn(e:Event):void{ trace('btn2 title') } )
&lt;/pre&gt;

So if you replace the body of tempfn with functions to update a text field or load an image and pass params to these functions like the example below...you have a way of getting events to do bespoke things quickly.

&lt;pre class="code"&gt;
btn.addEventListener(MouseEvent.CLICK, function tempfn(e:Event):void{ updateTf('btn title'), loadImage('imageName.jpg') } )
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Here is an approach I use when I want to pass arguments with events. It&#8217;s kind of similar to Jonathon&#8217;s, but I thought it worth posting. I find this useful for testing things and if I am in a rush and various other times!</p>
<p>Example 1.<br />
This is when I want to bind activity to one particular event of one display object:</p>
<pre class="code">
btn.addEventListener(MouseEvent.CLICK, tempfn)
function tempfn(e:Event):void
{
	trace('btn title')
}
</pre>
<p>Example 2.</p>
<p>If you want to do this for more than one object..</p>
<p>Use a literal function (I think that&#8217;s the right term). Any road, in the example below, when the user clicks on &#8216;btn&#8217;, or &#8216;btn2&#8242;, the statements within the function literal tempfn - declared as the function for the event - will fire.</p>
<pre class="code">
btn.addEventListener(MouseEvent.CLICK, function tempfn(e:Event):void{ trace('btn title') } )
btn2.addEventListener(MouseEvent.CLICK, function tempfn(e:Event):void{ trace('btn2 title') } )
</pre>
<p>So if you replace the body of tempfn with functions to update a text field or load an image and pass params to these functions like the example below&#8230;you have a way of getting events to do bespoke things quickly.</p>
<pre class="code">
btn.addEventListener(MouseEvent.CLICK, function tempfn(e:Event):void{ updateTf('btn title'), loadImage('imageName.jpg') } )
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: John laPlante</title>
		<link>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-3972</link>
		<dc:creator>John laPlante</dc:creator>
		<pubDate>Tue, 22 Sep 2009 13:14:38 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-3972</guid>
		<description>@Rich, thanks for that tip. I spent some time looking at MouseEvent and I see that is the avenue I would need to go down. The crux of my point is that adding a dispatch statement to a callback method requires that work everytime. I was inquiring into solutions that are more general and that a developer could setup once and use over and over. I will look into this some more and maybe post back.</description>
		<content:encoded><![CDATA[<p>@Rich, thanks for that tip. I spent some time looking at MouseEvent and I see that is the avenue I would need to go down. The crux of my point is that adding a dispatch statement to a callback method requires that work everytime. I was inquiring into solutions that are more general and that a developer could setup once and use over and over. I will look into this some more and maybe post back.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Farzan mc</title>
		<link>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-3966</link>
		<dc:creator>Farzan mc</dc:creator>
		<pubDate>Tue, 22 Sep 2009 04:22:16 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-3966</guid>
		<description>Hello. This was a great article. I was googling for this, i think for months but i couldn't find exactly what i wanted. Passing arquments with custom events is so helpfull and  handy in designing websites.
Thank you.</description>
		<content:encoded><![CDATA[<p>Hello. This was a great article. I was googling for this, i think for months but i couldn&#8217;t find exactly what i wanted. Passing arquments with custom events is so helpfull and  handy in designing websites.<br />
Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-3952</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Mon, 21 Sep 2009 12:18:20 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-3952</guid>
		<description>@John, can you clarify a bit? You wouldn't extend the button class to accomplish what you're describing. You seem to be describing something like this: First, add an event called EXTENDED_CLICK to the MouseEvent class. Next add a String (or untyped) parameter to that class so you can pass data along with the event. Last, make the new event dispatch via the mouse? Does that sound right?</description>
		<content:encoded><![CDATA[<p>@John, can you clarify a bit? You wouldn&#8217;t extend the button class to accomplish what you&#8217;re describing. You seem to be describing something like this: First, add an event called EXTENDED_CLICK to the MouseEvent class. Next add a String (or untyped) parameter to that class so you can pass data along with the event. Last, make the new event dispatch via the mouse? Does that sound right?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John laPlante</title>
		<link>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-3835</link>
		<dc:creator>John laPlante</dc:creator>
		<pubDate>Mon, 14 Sep 2009 15:13:53 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-3835</guid>
		<description>I found the article valuable for explaining how to dispatch custom events. That certainly seems easier in AS3 than AS2 but in any case very useful. I agree that the example is one that would be hard to justify unless there was some serious scaling issues. For a simple Flash movie, the simpler approaches would be awful appealing. The one thing that I'd like to see is an explanation how to extend the button class so that I could do something like follow:

regBtn.addEventListener(MouseEvent.EXTENDED_CLICK, onReg, "Claire", false, 0, true);

This apppoach might be a lot of work behind the scenes to setup but thereafter, I could use the EXTENDED_CLICK event whenever I have a button.</description>
		<content:encoded><![CDATA[<p>I found the article valuable for explaining how to dispatch custom events. That certainly seems easier in AS3 than AS2 but in any case very useful. I agree that the example is one that would be hard to justify unless there was some serious scaling issues. For a simple Flash movie, the simpler approaches would be awful appealing. The one thing that I&#8217;d like to see is an explanation how to extend the button class so that I could do something like follow:</p>
<p>regBtn.addEventListener(MouseEvent.EXTENDED_CLICK, onReg, &#8220;Claire&#8221;, false, 0, true);</p>
<p>This apppoach might be a lot of work behind the scenes to setup but thereafter, I could use the EXTENDED_CLICK event whenever I have a button.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Passing Arguments with CustomEvents &#124; Andy D</title>
		<link>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-3562</link>
		<dc:creator>Passing Arguments with CustomEvents &#124; Andy D</dc:creator>
		<pubDate>Sun, 16 Aug 2009 07:49:53 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/#comment-3562</guid>
		<description>[...] good examples; 1. http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/ 2. http://evolve.reintroducing.com/2007/10/23/as3/as3-custom-events/    Categories: Uncategorized [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] good examples; 1. <a href="http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/" rel="nofollow">http://www.learningactionscript3.com/2008/11/11/passing-arguments-with-events/</a> 2. <a href="http://evolve.reintroducing.com/2007/10/23/as3/as3-custom-events/" rel="nofollow">http://evolve.reintroducing.com/2007/10/23/as3/as3-custom-events/</a>    Categories: Uncategorized [&#8230;]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

