<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Flex related</title>
	<atom:link href="http://dorudan.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dorudan.wordpress.com</link>
	<description>Adobe Flex and ActionScript 3.0 articles and tutorials</description>
	<lastBuildDate>Mon, 18 Feb 2008 21:53:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='dorudan.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Flex related</title>
		<link>http://dorudan.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://dorudan.wordpress.com/osd.xml" title="Flex related" />
	<atom:link rel='hub' href='http://dorudan.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Stopping an Event Dispatch</title>
		<link>http://dorudan.wordpress.com/2008/02/16/stopping-an-event-dispatch/</link>
		<comments>http://dorudan.wordpress.com/2008/02/16/stopping-an-event-dispatch/#comments</comments>
		<pubDate>Sat, 16 Feb 2008 22:35:28 +0000</pubDate>
		<dc:creator>Doru Adrian Dan</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Articles]]></category>
		<category><![CDATA[Event]]></category>

		<guid isPermaLink="false">http://dorudan.wordpress.com/?p=4</guid>
		<description><![CDATA[At any point during the event flow, every event listener can put a stop on the entire event dispatch. To stop an event dispatch, we invoke the Event class&#8217;s instance method stopImmediatePropagation() or stopPropagation(). For example, suppose we have a Sprite, container that contains a TextField, child: var container:Sprite = new Sprite(); var child:TextField = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dorudan.wordpress.com&amp;blog=2830785&amp;post=4&amp;subd=dorudan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>At any point during the event flow, every event listener can put a stop on the entire event dispatch.<br />
To stop an event dispatch, we invoke the Event class&#8217;s instance method <b><i>stopImmediatePropagation()</i></b> or <b><i>stopPropagation()</i></b>.</p>
<p>For example, suppose we have a Sprite, <b>container</b> that contains a TextField, <b>child</b>:</p>
<p><code>var container:Sprite = new Sprite();<br />
var child:TextField = new TextField();<br />
child.text = "click here";<br />
child.autoSize = TextFieldAutoSize.LEFT;<br />
container.addChild(child);</code></p>
<p>Further suppose we have three event listener functions: containerClickListenerOne(), containerClickListenerTwo() and childClickListener().<br />
<code><br />
container.addEventListener(MouseEvent.CLICK, containerClickListenerOne, true)<br />
container.addEventListener(MouseEvent.CLICK, containerClickListenerTwo, true)<br />
child.addEventListener(MouseEvent.CLICK, childClickListener, false);</code></p>
<p>Under normal circumstances, when the user clicks <b>child</b>, all three events listeners are triggered &#8211; two during the capture phase, and one during the target phase. If, however, containerClickListenerOne() consumes the event using stopImmediatePropagation(), then neither containerClickListenerTwo() nor childClickListener() is triggered.</p>
<p><code>public function containerClickListenerOne(e:MouseEvent) : void {<br />
e.stopImmediatePropagation();<br />
}</code></p>
<p>On the other hand, if containerClickListenerOne() consumes the event using stopPropagation(), then container&#8217;s remaining MouseEvent.CLICK event listeners are triggered before the event dispatch stops. Hance, containerClickListenerTwo() receives the event, but childClickListener() does not.</p>
<p><code>public function containerClickListenerOne(e:MouseEvent) : void {<br />
e.stopPropagation();<br />
}</code></p>
<p>Note that the preceding examples relies on containerClickListenerOne() being registered before containerClickListenerTwo().</p>
<p>Events are typically consumed in order to stop or override a program&#8217;s normal response to an event. For example, suppose a Sprite subclass, ToolPanel, contains a group of interface controls, each of which accepts user input. The ToolPanel class has two operational states: enabled and disabled. When a ToolPanel object is disabled, the user should not be able to interact with any of its nested interface controls.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dorudan.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dorudan.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dorudan.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dorudan.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dorudan.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dorudan.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dorudan.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dorudan.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dorudan.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dorudan.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dorudan.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dorudan.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dorudan.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dorudan.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dorudan.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dorudan.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dorudan.wordpress.com&amp;blog=2830785&amp;post=4&amp;subd=dorudan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dorudan.wordpress.com/2008/02/16/stopping-an-event-dispatch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fde660e1a8f3639743327b2b195debeb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Doru Adrian Dan</media:title>
		</media:content>
	</item>
	</channel>
</rss>
