<?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: Event Listener Priority</title>
	<link>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/</link>
	<description>A digital supplement for the O'Reilly book</description>
	<pubDate>Tue, 07 Sep 2010 08:14:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-6420</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Mon, 26 Apr 2010 19:51:09 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-6420</guid>
		<description>@Razvi, glad to be of help!</description>
		<content:encoded><![CDATA[<p>@Razvi, glad to be of help!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-6419</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Mon, 26 Apr 2010 19:50:00 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-6419</guid>
		<description>@Triynko, &lt;span class="inlineas"&gt;removeEventListener()&lt;/span&gt; requires two parameters: &lt;span class="inlineas"&gt;type:String&lt;/span&gt; and &lt;span class="inlineas"&gt;listener:Function&lt;/span&gt;.  (See &lt;a href="http://tinyurl.com/removeEventListener" rel="nofollow"&gt;Adobe LiveDocs&lt;/a&gt;.) The third parameter, &lt;span class="inlineas"&gt;useCapture:Boolean&lt;/span&gt; is optional, and is false by default. It is only needed when you must remove a listener that uses the capture phase.</description>
		<content:encoded><![CDATA[<p>@Triynko, <span class="inlineas">removeEventListener()</span> requires two parameters: <span class="inlineas">type:String</span> and <span class="inlineas">listener:Function</span>.  (See <a href="http://tinyurl.com/removeEventListener" rel="nofollow">Adobe LiveDocs</a>.) The third parameter, <span class="inlineas">useCapture:Boolean</span> is optional, and is false by default. It is only needed when you must remove a listener that uses the capture phase.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Triynko</title>
		<link>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-6417</link>
		<dc:creator>Triynko</dc:creator>
		<pubDate>Mon, 26 Apr 2010 17:43:03 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-6417</guid>
		<description>@Rich: No, the removeEventListener method takes three (3) parameters, and must include the event phase in order to properly unregister the event.  Passing only two parameters will result in an error.</description>
		<content:encoded><![CDATA[<p>@Rich: No, the removeEventListener method takes three (3) parameters, and must include the event phase in order to properly unregister the event.  Passing only two parameters will result in an error.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Razvi</title>
		<link>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-3532</link>
		<dc:creator>Razvi</dc:creator>
		<pubDate>Wed, 12 Aug 2009 07:47:22 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-3532</guid>
		<description>Just wanted to say thanks for reminding me of the priority parameter. Helped me a lot</description>
		<content:encoded><![CDATA[<p>Just wanted to say thanks for reminding me of the priority parameter. Helped me a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-3112</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Tue, 09 Jun 2009 15:42:14 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-3112</guid>
		<description>@Fluena, yes, &lt;a href="/2008/11/11/passing-arguments-with-events/" rel="nofollow"&gt;using a custom class&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>@Fluena, yes, <a href="/2008/11/11/passing-arguments-with-events/" rel="nofollow">using a custom class</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fluena</title>
		<link>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-3109</link>
		<dc:creator>Fluena</dc:creator>
		<pubDate>Tue, 09 Jun 2009 14:56:18 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-3109</guid>
		<description>Is there a way to pass an argument to a function that I call from event listener?</description>
		<content:encoded><![CDATA[<p>Is there a way to pass an argument to a function that I call from event listener?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-1843</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Mon, 02 Feb 2009 18:20:22 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-1843</guid>
		<description>@Chuck: First, you can easily sequence events. The first event listener can dispatch an event to another listener. In your case, however, it sounds like you probably need to wait for two independent events because you may not know which event completes first. In that case, the most straight forward thing is to check a property related to the other process (upon loading, is the alpha 0; and upon alpha==0, is the image loaded?) 

Or, in more complex scenarios, you can set flags that indicate what has been completed. For example, if you need to load/fade 10 images, you can set values in an array after each event is dispatched, checking on the status of the array every time. Therefore, after the last event is received, the array will be chock full and you're good to go.

I'm sure there are other approaches, too.</description>
		<content:encoded><![CDATA[<p>@Chuck: First, you can easily sequence events. The first event listener can dispatch an event to another listener. In your case, however, it sounds like you probably need to wait for two independent events because you may not know which event completes first. In that case, the most straight forward thing is to check a property related to the other process (upon loading, is the alpha 0; and upon alpha==0, is the image loaded?) </p>
<p>Or, in more complex scenarios, you can set flags that indicate what has been completed. For example, if you need to load/fade 10 images, you can set values in an array after each event is dispatched, checking on the status of the array every time. Therefore, after the last event is received, the array will be chock full and you&#8217;re good to go.</p>
<p>I&#8217;m sure there are other approaches, too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck Uebele</title>
		<link>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-1839</link>
		<dc:creator>Chuck Uebele</dc:creator>
		<pubDate>Mon, 02 Feb 2009 15:03:20 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-1839</guid>
		<description>How would you handle triggering an event when you are waiting for listeners to trigger?  For example: in a photo gallery that is XML based, the new image is loading while the old image is fading from the stage.  I want to make sure that both the image is loaded and the old image has faded before fading in the new image.  The listeners are attached to the loader and one to a sprite that grays out a section of the stage.</description>
		<content:encoded><![CDATA[<p>How would you handle triggering an event when you are waiting for listeners to trigger?  For example: in a photo gallery that is XML based, the new image is loading while the old image is fading from the stage.  I want to make sure that both the image is loaded and the old image has faded before fading in the new image.  The listeners are attached to the loader and one to a sprite that grays out a section of the stage.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-1719</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Wed, 14 Jan 2009 02:15:00 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-1719</guid>
		<description>@Jeff, no that will actually cause an error. The &lt;span class="inlineas"&gt;removeEventListener()&lt;/span&gt; method only accepts two parameters: the event and the function called when the event is trapped. These are used in combination to identify the correct listener for removal. 

The &lt;span class="inlineas"&gt;capturePhase, priority&lt;/span&gt;, and &lt;span class="inlineas"&gt;weakReference&lt;/span&gt; parameters are only used when registering the listener.</description>
		<content:encoded><![CDATA[<p>@Jeff, no that will actually cause an error. The <span class="inlineas">removeEventListener()</span> method only accepts two parameters: the event and the function called when the event is trapped. These are used in combination to identify the correct listener for removal. </p>
<p>The <span class="inlineas">capturePhase, priority</span>, and <span class="inlineas">weakReference</span> parameters are only used when registering the listener.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff</title>
		<link>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-1718</link>
		<dc:creator>Jeff</dc:creator>
		<pubDate>Wed, 14 Jan 2009 02:07:42 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/11/event-listener-priority/#comment-1718</guid>
		<description>When removing a listener that includes the third, fourth, and fifth parameters (see book p.47), is it best practice to include those parameter in the removal statement? For example:
btn.addEventListener(MouseEvent.CLICK, onBtnClick, false, 0, true);
btn.removeEventListener(MouseEvent.CLICK, onBtnClick, false, 0, true);

or can you exclude the last three parameters like this:
btn.removeEventListener(MouseEvent.CLICK, onBtnClick);</description>
		<content:encoded><![CDATA[<p>When removing a listener that includes the third, fourth, and fifth parameters (see book p.47), is it best practice to include those parameter in the removal statement? For example:<br />
btn.addEventListener(MouseEvent.CLICK, onBtnClick, false, 0, true);<br />
btn.removeEventListener(MouseEvent.CLICK, onBtnClick, false, 0, true);</p>
<p>or can you exclude the last three parameters like this:<br />
btn.removeEventListener(MouseEvent.CLICK, onBtnClick);</p>
]]></content:encoded>
	</item>
</channel>
</rss>
