<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: AS3 HitTest Checks on ActionScript 3.0</title>
	<atom:link href="http://www.isgoodstuff.com/2008/08/06/as-3-hittest-checks-on-actionscript-30/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.isgoodstuff.com/2008/08/06/as-3-hittest-checks-on-actionscript-30/</link>
	<description>All the good stuff here!</description>
	<lastBuildDate>Thu, 09 Feb 2012 13:10:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: arnaud</title>
		<link>http://www.isgoodstuff.com/2008/08/06/as-3-hittest-checks-on-actionscript-30/comment-page-1/#comment-600</link>
		<dc:creator>arnaud</dc:creator>
		<pubDate>Sun, 14 Nov 2010 11:28:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.isgoodstuff.com/?p=139#comment-600</guid>
		<description>import caurina.transitions.*;
import flash.events.KeyboardEvent;

var t: targ1 = new targ1();
t.x = 340;
t.y = 145;
addChild(t);
var t2: targ2 = new targ2();
t2.x = 800;
t2.y = 600;
addChild(t2);
var s: symbol1 = new symbol1();
s.x = 50;
s.y = 50;
addChild(s);
var s2: symbol2 = new symbol2();
s2.x = 500;
s2.y = 500;
addChild(s2);


function beginDrag(e:MouseEvent):void {
	stage.addEventListener(MouseEvent.MOUSE_MOVE,moveMC);
	stage.addEventListener(MouseEvent.MOUSE_UP,endDrag);
}

s.addEventListener(MouseEvent.MOUSE_DOWN,beginDrag);
s2.addEventListener(MouseEvent.MOUSE_DOWN,beginDrag);

function endDrag(e:MouseEvent):void {
	stage.removeEventListener(MouseEvent.MOUSE_MOVE,moveMC);
	
	if (s.hitTestObject(t)) {
		Tweener.addTween(s,{x:340, y:145, time:.5, transition:&quot;easeIn&quot;});

	} else {
		Tweener.addTween(s,{x:mouseX, y:mouseY, time:1, transition:&quot;easeIn&quot;});
	}
	
	if (s2.hitTestObject(t2)) {
		Tweener.addTween(s2,{x:800, y:600, time:.5, transition:&quot;easeIn&quot;});

	} else {
		Tweener.addTween(s2,{x:mouseX, y:mouseY, time:1, transition:&quot;easeIn&quot;});
	}
	
	stage.removeEventListener(MouseEvent.MOUSE_UP,endDrag);
}

function moveMC(e:MouseEvent):void {

	Tweener.addTween(s,{x:mouseX,y:mouseY,time:10,transition:&quot;easIn&quot;});
	e.updateAfterEvent();
	Tweener.addTween(s2,{x:mouseX,y:mouseY,time:10,transition:&quot;easIn&quot;});
	e.updateAfterEvent();
}

stop();




i have a probleme with my code...
if i want to drag one of my object, both are moving ...
someone has an idea ?</description>
		<content:encoded><![CDATA[<p>import caurina.transitions.*;<br />
import flash.events.KeyboardEvent;</p>
<p>var t: targ1 = new targ1();<br />
t.x = 340;<br />
t.y = 145;<br />
addChild(t);<br />
var t2: targ2 = new targ2();<br />
t2.x = 800;<br />
t2.y = 600;<br />
addChild(t2);<br />
var s: symbol1 = new symbol1();<br />
s.x = 50;<br />
s.y = 50;<br />
addChild(s);<br />
var s2: symbol2 = new symbol2();<br />
s2.x = 500;<br />
s2.y = 500;<br />
addChild(s2);</p>
<p>function beginDrag(e:MouseEvent):void {<br />
	stage.addEventListener(MouseEvent.MOUSE_MOVE,moveMC);<br />
	stage.addEventListener(MouseEvent.MOUSE_UP,endDrag);<br />
}</p>
<p>s.addEventListener(MouseEvent.MOUSE_DOWN,beginDrag);<br />
s2.addEventListener(MouseEvent.MOUSE_DOWN,beginDrag);</p>
<p>function endDrag(e:MouseEvent):void {<br />
	stage.removeEventListener(MouseEvent.MOUSE_MOVE,moveMC);</p>
<p>	if (s.hitTestObject(t)) {<br />
		Tweener.addTween(s,{x:340, y:145, time:.5, transition:&#8221;easeIn&#8221;});</p>
<p>	} else {<br />
		Tweener.addTween(s,{x:mouseX, y:mouseY, time:1, transition:&#8221;easeIn&#8221;});<br />
	}</p>
<p>	if (s2.hitTestObject(t2)) {<br />
		Tweener.addTween(s2,{x:800, y:600, time:.5, transition:&#8221;easeIn&#8221;});</p>
<p>	} else {<br />
		Tweener.addTween(s2,{x:mouseX, y:mouseY, time:1, transition:&#8221;easeIn&#8221;});<br />
	}</p>
<p>	stage.removeEventListener(MouseEvent.MOUSE_UP,endDrag);<br />
}</p>
<p>function moveMC(e:MouseEvent):void {</p>
<p>	Tweener.addTween(s,{x:mouseX,y:mouseY,time:10,transition:&#8221;easIn&#8221;});<br />
	e.updateAfterEvent();<br />
	Tweener.addTween(s2,{x:mouseX,y:mouseY,time:10,transition:&#8221;easIn&#8221;});<br />
	e.updateAfterEvent();<br />
}</p>
<p>stop();</p>
<p>i have a probleme with my code&#8230;<br />
if i want to drag one of my object, both are moving &#8230;<br />
someone has an idea ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shaun</title>
		<link>http://www.isgoodstuff.com/2008/08/06/as-3-hittest-checks-on-actionscript-30/comment-page-1/#comment-598</link>
		<dc:creator>Shaun</dc:creator>
		<pubDate>Thu, 11 Nov 2010 04:07:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.isgoodstuff.com/?p=139#comment-598</guid>
		<description>Hi

I&#039;ve copied the above code into Flash CS5.

It works, only when I let go of the red square, it stays stuck to the mouse pointer.

I can&#039;t see a problem with your code.

Any ideas why this is happening?

Cheers

Shaun</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>I&#8217;ve copied the above code into Flash CS5.</p>
<p>It works, only when I let go of the red square, it stays stuck to the mouse pointer.</p>
<p>I can&#8217;t see a problem with your code.</p>
<p>Any ideas why this is happening?</p>
<p>Cheers</p>
<p>Shaun</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mr.GoodStuff</title>
		<link>http://www.isgoodstuff.com/2008/08/06/as-3-hittest-checks-on-actionscript-30/comment-page-1/#comment-91</link>
		<dc:creator>Mr.GoodStuff</dc:creator>
		<pubDate>Thu, 14 Aug 2008 12:08:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.isgoodstuff.com/?p=139#comment-91</guid>
		<description>Hiya liz, just if hittest is true; do this assign coordinate of MovieClipRed&#039;s x and y to MovieClipBlue.x and MovieClipBlue.y this will make blue snap perfectly on to the red. Then, MovieClipBlue.removeListener() on the blue clip to stop it from being dragged another :)</description>
		<content:encoded><![CDATA[<p>Hiya liz, just if hittest is true; do this assign coordinate of MovieClipRed&#8217;s x and y to MovieClipBlue.x and MovieClipBlue.y this will make blue snap perfectly on to the red. Then, MovieClipBlue.removeListener() on the blue clip to stop it from being dragged another <img src='http://www.isgoodstuff.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Liz</title>
		<link>http://www.isgoodstuff.com/2008/08/06/as-3-hittest-checks-on-actionscript-30/comment-page-1/#comment-90</link>
		<dc:creator>Liz</dc:creator>
		<pubDate>Thu, 14 Aug 2008 10:55:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.isgoodstuff.com/?p=139#comment-90</guid>
		<description>Re: Hit Test Tutorial

How does the code go once the red button is over the blue button so it locks in the exact spot of the blue and you can&#039;t move it anymore?

Cheers Liz</description>
		<content:encoded><![CDATA[<p>Re: Hit Test Tutorial</p>
<p>How does the code go once the red button is over the blue button so it locks in the exact spot of the blue and you can&#8217;t move it anymore?</p>
<p>Cheers Liz</p>
]]></content:encoded>
	</item>
</channel>
</rss>

