<?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: Stopping Event Propagation</title>
	<link>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/</link>
	<description>A digital supplement for the O'Reilly book</description>
	<pubDate>Sat, 04 Feb 2012 06:15:02 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-18915</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Tue, 19 Jul 2011 14:06:48 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-18915</guid>
		<description>@dmc, glad you like it!</description>
		<content:encoded><![CDATA[<p>@dmc, glad you like it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dmc</title>
		<link>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-14248</link>
		<dc:creator>dmc</dc:creator>
		<pubDate>Mon, 04 Apr 2011 22:23:11 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-14248</guid>
		<description>simple, but useful, I've just used this function for stopping a mouse click propagation in my new game. 
Thanks for sharing ;-)</description>
		<content:encoded><![CDATA[<p>simple, but useful, I&#8217;ve just used this function for stopping a mouse click propagation in my new game.<br />
Thanks for sharing <img src='http://www.learningactionscript3.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-7979</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Mon, 09 Aug 2010 01:07:09 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-7979</guid>
		<description>@Rich, thanks.  That's a much better solution.  It worked perfectly.  Thanks.</description>
		<content:encoded><![CDATA[<p>@Rich, thanks.  That&#8217;s a much better solution.  It worked perfectly.  Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-7950</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Sat, 07 Aug 2010 03:29:34 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-7950</guid>
		<description>@Chris, there's a better way to do what you want than by stopping event propagation. Just change your &lt;span class="inlineas"&gt;onStartDrag()&lt;/span&gt; method to the following:

&lt;pre class="code"&gt;
function onStartDrag(evt:MouseEvent):void {
    evt.currentTarget.startDrag();
}
&lt;/pre&gt;

The currentTarget is the object to which the listener is attached. So, only the keyboard will drag.</description>
		<content:encoded><![CDATA[<p>@Chris, there&#8217;s a better way to do what you want than by stopping event propagation. Just change your <span class="inlineas">onStartDrag()</span> method to the following:</p>
<pre class="code">
function onStartDrag(evt:MouseEvent):void {
    evt.currentTarget.startDrag();
}
</pre>
<p>The currentTarget is the object to which the listener is attached. So, only the keyboard will drag.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-7949</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Sat, 07 Aug 2010 02:11:32 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-7949</guid>
		<description>Does this work with startDrag? 

Below is a code example that makes a parent box (p) with multiple children boxes (c).  I want the patent to drag but not the children.  Imaging I'm building a keyboard where I want to be able to move the entire keyboard but not individual keys.

How do I stop the children from being individually draggable?

&lt;pre class="code"&gt;
package {

   import flash.display.Sprite;
   import flash.events.MouseEvent;

   public class Main extends Sprite {

      public function Main() {
         var p:Sprite = new Sprite();
         p.graphics.lineStyle(2,0x62555E);
         p.graphics.beginFill(0xF2E8E8);
         p.graphics.drawRoundRect(0, 0, 400, 200, 10);
         p.graphics.endFill();
         p.x = 10;
         p.y = 100;
         addChild(p);

         p.addEventListener(MouseEvent.MOUSE_DOWN, onStartDrag, 
                            false, 0, true);
         p.addEventListener(MouseEvent.MOUSE_UP, onStopDrag, 
                            false, 0, true);

         var boxX:int = 50;
         for (var i=0; i &lt; 8; i++) {
            var c:Sprite=new Sprite;
            c.name = "c_" + i;
            c.graphics.lineStyle(NaN, 0xffffff);
            c.graphics.beginFill(0x627b78);
            c.graphics.drawRoundRect(boxX, 30, 30, 30, 10);
            c.graphics.endFill();
            p.addChild(c);
            boxX  += 40;
         }

      }
      function onStartDrag(evt:MouseEvent):void {
         evt.target.startDrag();
         evt.stopPropagation();
         //evt.stopImmediatePropagation();
      }
      function onStopDrag(evt:MouseEvent):void {
         evt.target.stopDrag();
      }
   }
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Does this work with startDrag? </p>
<p>Below is a code example that makes a parent box (p) with multiple children boxes (c).  I want the patent to drag but not the children.  Imaging I&#8217;m building a keyboard where I want to be able to move the entire keyboard but not individual keys.</p>
<p>How do I stop the children from being individually draggable?</p>
<pre class="code">
package {

   import flash.display.Sprite;
   import flash.events.MouseEvent;

   public class Main extends Sprite {

      public function Main() {
         var p:Sprite = new Sprite();
         p.graphics.lineStyle(2,0x62555E);
         p.graphics.beginFill(0xF2E8E8);
         p.graphics.drawRoundRect(0, 0, 400, 200, 10);
         p.graphics.endFill();
         p.x = 10;
         p.y = 100;
         addChild(p);

         p.addEventListener(MouseEvent.MOUSE_DOWN, onStartDrag,
                            false, 0, true);
         p.addEventListener(MouseEvent.MOUSE_UP, onStopDrag,
                            false, 0, true);

         var boxX:int = 50;
         for (var i=0; i < 8; i++) {
            var c:Sprite=new Sprite;
            c.name = "c_" + i;
            c.graphics.lineStyle(NaN, 0xffffff);
            c.graphics.beginFill(0x627b78);
            c.graphics.drawRoundRect(boxX, 30, 30, 30, 10);
            c.graphics.endFill();
            p.addChild(c);
            boxX  += 40;
         }

      }
      function onStartDrag(evt:MouseEvent):void {
         evt.target.startDrag();
         evt.stopPropagation();
         //evt.stopImmediatePropagation();
      }
      function onStopDrag(evt:MouseEvent):void {
         evt.target.stopDrag();
      }
   }
}
</pre>
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Igor</title>
		<link>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-3110</link>
		<dc:creator>Igor</dc:creator>
		<pubDate>Tue, 09 Jun 2009 14:59:23 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-3110</guid>
		<description>Thanks that helped me a lot</description>
		<content:encoded><![CDATA[<p>Thanks that helped me a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: egerg</title>
		<link>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-1297</link>
		<dc:creator>egerg</dc:creator>
		<pubDate>Sun, 30 Nov 2008 00:10:05 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-1297</guid>
		<description>Thank you, now i finally understand what stoppropagation does :)</description>
		<content:encoded><![CDATA[<p>Thank you, now i finally understand what stoppropagation does <img src='http://www.learningactionscript3.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hongchao</title>
		<link>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-157</link>
		<dc:creator>hongchao</dc:creator>
		<pubDate>Sat, 19 Jul 2008 16:02:36 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-157</guid>
		<description>lick actionscript very much!</description>
		<content:encoded><![CDATA[<p>lick actionscript very much!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hongchao</title>
		<link>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-156</link>
		<dc:creator>hongchao</dc:creator>
		<pubDate>Sat, 19 Jul 2008 16:00:33 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2007/11/19/stopping-event-propagation/#comment-156</guid>
		<description>learning actionscript3.0!!</description>
		<content:encoded><![CDATA[<p>learning actionscript3.0!!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

