<?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 Phases in Action</title>
	<link>http://www.learningactionscript3.com/2007/11/10/event-phases-in-action/</link>
	<description>A digital supplement for the O'Reilly book</description>
	<pubDate>Thu, 20 Nov 2008 08:20:55 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2007/11/10/event-phases-in-action/#comment-39</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Mon, 24 Mar 2008 05:51:20 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/10/event-phases-in-action/#comment-39</guid>
		<description>Gek, you're almost right.

The first thing to remember is that, for display list objects, the Capture, Target, and Bubbling phases always occur, and the event always starts at the top-most parent, propagates down to the target and then bubbles back up. In this regard, your first impression was correct, and the subtle inaccuracy is your use of the phrase "capture phase will not be triggered." The event always propagates as described (so the Capture phase is there and events are cascading down to the target), and the only question is, when is the &lt;i&gt;listener function&lt;/i&gt; triggered? 

Because the useCapture argument is false by default, the default behavior is to start paying attention when the event reaches the target, and then as it bubbles back up through the display list--hence the behavior you're witnessing in the sample file. If you set useCapture to true, your app will be actively listening for the event only on the way down to the target. To listen through the entire round trip, you need to create two copies of the same listener, one with useCapture set to true, and the other with the parameter set to false, as described above.</description>
		<content:encoded><![CDATA[<p>Gek, you&#8217;re almost right.</p>
<p>The first thing to remember is that, for display list objects, the Capture, Target, and Bubbling phases always occur, and the event always starts at the top-most parent, propagates down to the target and then bubbles back up. In this regard, your first impression was correct, and the subtle inaccuracy is your use of the phrase &#8220;capture phase will not be triggered.&#8221; The event always propagates as described (so the Capture phase is there and events are cascading down to the target), and the only question is, when is the <i>listener function</i> triggered? </p>
<p>Because the useCapture argument is false by default, the default behavior is to start paying attention when the event reaches the target, and then as it bubbles back up through the display list&#8211;hence the behavior you&#8217;re witnessing in the sample file. If you set useCapture to true, your app will be actively listening for the event only on the way down to the target. To listen through the entire round trip, you need to create two copies of the same listener, one with useCapture set to true, and the other with the parameter set to false, as described above.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gek Hua</title>
		<link>http://www.learningactionscript3.com/2007/11/10/event-phases-in-action/#comment-37</link>
		<dc:creator>Gek Hua</dc:creator>
		<pubDate>Mon, 24 Mar 2008 03:55:02 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/10/event-phases-in-action/#comment-37</guid>
		<description>here i would like to comment on the part of the text relating to event propagation, in particular to the book explanation on event_propagation2.fla. 

The book mentioned "The target of the event dispatched to the display list will be folder0, it will propagate
through the list until it reaches folder0, and then it will bubble back up." This gave me an impression that the event went through the flow - Stage &#62; folder_group &#62; folder0. However, according to the Help files, useCapture is false by default and so the capture phase will not be triggered. My explanation is: since the bubbles property of the MOUSE_OVER event is true, the event actually bubbles up (instead of cascading down) and is eventually handled by the event handler assigned to folder_group. Am i right?</description>
		<content:encoded><![CDATA[<p>here i would like to comment on the part of the text relating to event propagation, in particular to the book explanation on event_propagation2.fla. </p>
<p>The book mentioned &#8220;The target of the event dispatched to the display list will be folder0, it will propagate<br />
through the list until it reaches folder0, and then it will bubble back up.&#8221; This gave me an impression that the event went through the flow - Stage &gt; folder_group &gt; folder0. However, according to the Help files, useCapture is false by default and so the capture phase will not be triggered. My explanation is: since the bubbles property of the MOUSE_OVER event is true, the event actually bubbles up (instead of cascading down) and is eventually handled by the event handler assigned to folder_group. Am i right?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2007/11/10/event-phases-in-action/#comment-29</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Fri, 15 Feb 2008 20:18:57 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/10/event-phases-in-action/#comment-29</guid>
		<description>@Rodney, you've got it. There are three things you can focus on in this scenario. The first is the use of the &lt;i&gt;this&lt;/i&gt; keyword. That keyword can be thought of as "self-referential." That is, it refers to the item/scope that the script is referencing. In this example, &lt;i&gt;this&lt;/i&gt; refers to the object to which the listener is attached. Therefore, the &lt;i&gt;folder_group&lt;/i&gt; movie clip that encloses all the folders is the object that is faded. 

The second thing is the event target. By using the &lt;i&gt;target&lt;/i&gt; property of the &lt;em&gt;evt&lt;/em&gt; parameter, you can determine which item triggered the listener--in this example, which item was rolled over or rolled out of. This handy property allows you to find only the object with which the user interacted, even when the event is cascading down, or bubbling up, through the display list.

A third property, not referenced in this example, is also sometimes useful. It is called &lt;i&gt;currentTarget&lt;/i&gt; and tells you which display object is processing the event at that moment. You can use this property to work with each parent the event goes through, if you want such a result.</description>
		<content:encoded><![CDATA[<p>@Rodney, you&#8217;ve got it. There are three things you can focus on in this scenario. The first is the use of the <i>this</i> keyword. That keyword can be thought of as &#8220;self-referential.&#8221; That is, it refers to the item/scope that the script is referencing. In this example, <i>this</i> refers to the object to which the listener is attached. Therefore, the <i>folder_group</i> movie clip that encloses all the folders is the object that is faded. </p>
<p>The second thing is the event target. By using the <i>target</i> property of the <em>evt</em> parameter, you can determine which item triggered the listener&#8211;in this example, which item was rolled over or rolled out of. This handy property allows you to find only the object with which the user interacted, even when the event is cascading down, or bubbling up, through the display list.</p>
<p>A third property, not referenced in this example, is also sometimes useful. It is called <i>currentTarget</i> and tells you which display object is processing the event at that moment. You can use this property to work with each parent the event goes through, if you want such a result.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rodney Gracia</title>
		<link>http://www.learningactionscript3.com/2007/11/10/event-phases-in-action/#comment-28</link>
		<dc:creator>Rodney Gracia</dc:creator>
		<pubDate>Fri, 15 Feb 2008 13:01:43 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/10/event-phases-in-action/#comment-28</guid>
		<description>So looking at the code for event_propagation2.fla confuses me a bit. I was under the impression that doing what you do here would make all the children of that mc change alpha when the mouse is over the group, but they don't. Only the folder mc under the mouse does change its alpha. So if I use 'this' instead of 'evt.target' the entire group changes alpha at the same time. So 'evt.taget' goes deep into a group of nested objects on the stage and always refers to the item that is being interacted with specifically?</description>
		<content:encoded><![CDATA[<p>So looking at the code for event_propagation2.fla confuses me a bit. I was under the impression that doing what you do here would make all the children of that mc change alpha when the mouse is over the group, but they don&#8217;t. Only the folder mc under the mouse does change its alpha. So if I use &#8216;this&#8217; instead of &#8216;evt.target&#8217; the entire group changes alpha at the same time. So &#8216;evt.taget&#8217; goes deep into a group of nested objects on the stage and always refers to the item that is being interacted with specifically?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
