<?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/"
	>

<channel>
	<title>Interactive Authoring</title>
	<atom:link href="http://jpdevries.com/classes/su09/wdim261/feed/" rel="self" type="application/rss+xml" />
	<link>http://jpdevries.com/classes/su09/wdim261</link>
	<description>Summer 09 WDIM 261 A</description>
	<lastBuildDate>Wed, 16 Sep 2009 16:38:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Never Ending Why</title>
		<link>http://jpdevries.com/classes/su09/wdim261/2009/09/16/never-ending-why/</link>
		<comments>http://jpdevries.com/classes/su09/wdim261/2009/09/16/never-ending-why/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 16:38:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jpdevries.com/classes/su09/wdim261/?p=96</guid>
		<description><![CDATA[
Check out this awesome interactive music video, a great example of blending timeline animation and ActionScript together for a unique interactive experience.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://theneverendingwhy.placeboworld.co.uk/"><img class="alignnone size-full wp-image-97" title="image" src="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/09/image.jpg" alt="image" width="500" height="297" /></a></p>
<p>Check out this awesome <a href="http://theneverendingwhy.placeboworld.co.uk/" target="_blank">interactive music video</a>, a great example of blending timeline animation and ActionScript together for a unique interactive experience.</p>
]]></content:encoded>
			<wfw:commentRss>http://jpdevries.com/classes/su09/wdim261/2009/09/16/never-ending-why/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Positioning Based on Mouse Location</title>
		<link>http://jpdevries.com/classes/su09/wdim261/2009/09/13/positioning-based-on-mouse-location/</link>
		<comments>http://jpdevries.com/classes/su09/wdim261/2009/09/13/positioning-based-on-mouse-location/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 23:07:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[mouse]]></category>

		<guid isPermaLink="false">http://jpdevries.com/classes/su09/wdim261/?p=88</guid>
		<description><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_mousemove_721448786"
			class="flashmovie"
			width="550"
			height="100">
	<param name="movie" value="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/09/mousemove.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/09/mousemove.swf"
			name="fm_mousemove_721448786"
			width="550"
			height="100">
	<!--<![endif]-->
		

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
Download the example here.
Positioning based on mouse location can be used for a lot of different visual effects in Flash. Here is a breakdown of the equation commonly used to achieve such a task:
First determine a left most and right post position for your Object
The left most position is [...]]]></description>
			<content:encoded><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_mousemove_1197148245"
			class="flashmovie"
			width="550"
			height="100">
	<param name="movie" value="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/09/mousemove.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/09/mousemove.swf"
			name="fm_mousemove_1197148245"
			width="550"
			height="100">
	<!--<![endif]-->
		<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Download the example <a href="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/09/mouseMove.zip">here</a>.</p>
<p>Positioning based on mouse location can be used for a lot of different visual effects in Flash. Here is a breakdown of the equation commonly used to achieve such a task:</p>
<p><strong>First determine a left most and right post position for your Object</strong></p>
<p>The left most position is where the object should be when the mouse is all the way to the left of the stage. The right most position is where your Object should be when the mouse is at the right most position of the stage.</p>
<p>For this example we&#8217;ll use 0 for our leftMostPosition and the stageWidth (550) for our rightMostPosition.</p>
<p><strong>Caclulate the distance between the two points</strong></p>
<p>To calculate the distance between your leftMostPosition and rightMostPosition, simply subtract them like so:</p>
<p><em>distance = rightMostPoint &#8211; leftMostPoint</em></p>
<p><strong>Calculate the Objects position based on the mouse</strong></p>
<p>In order to calculate the position, we need to get a decimal number that represents where the mouse is in relation to the leftMost and rightMost points. Because we are using 0 and stageWidth for this example, we calcualte this distance like so:</p>
<p><em>mouseDecimal = mouseX / stageWidth</em></p>
<p>So if the mouse is at 0, mouseDecimal will be 0, if the mouse is at the stageWidth (far right) mouseDecimal will be 1, anywhere else, it will be somewhere inbetween 0 and 1.</p>
<p>To position our clip, we just multiply the distance by the mouseDecimal and add the leftMostPosition like so:</p>
<p><em>box.x = leftMostPosition + (mouseDecimal * distance);</em></p>
]]></content:encoded>
			<wfw:commentRss>http://jpdevries.com/classes/su09/wdim261/2009/09/13/positioning-based-on-mouse-location/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS 3 Hit Detection</title>
		<link>http://jpdevries.com/classes/su09/wdim261/2009/09/13/as-3-hit-detection/</link>
		<comments>http://jpdevries.com/classes/su09/wdim261/2009/09/13/as-3-hit-detection/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 22:31:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[bitmap]]></category>
		<category><![CDATA[gskinner]]></category>
		<category><![CDATA[hit detection]]></category>

		<guid isPermaLink="false">http://jpdevries.com/classes/su09/wdim261/?p=77</guid>
		<description><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_gcollision_745946973"
			class="flashmovie"
			width="310"
			height="500">
	<param name="movie" value="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/09/gcollision.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/09/gcollision.swf"
			name="fm_gcollision_745946973"
			width="310"
			height="500">
	<!--<![endif]-->
		


	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
Get the source example here.
What&#8217;s hit detection?
Hit detection is the ability to determine whether or not two DisplayObjects are colliding.
How&#8217;s it work?
It can be achieved any number of ways. Generally speaking, there are two ways of accomplishing this.
The first is the most basic, and limited, and it is to [...]]]></description>
			<content:encoded><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_gcollision_597235903"
			class="flashmovie"
			width="310"
			height="500">
	<param name="movie" value="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/09/gcollision.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/09/gcollision.swf"
			name="fm_gcollision_597235903"
			width="310"
			height="500">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Get the source example <a title="GCollision Example Source" href="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/09/gcollision.zip">here</a>.</p>
<p><strong>What&#8217;s hit detection?</strong></p>
<p>Hit detection is the ability to determine whether or not two DisplayObjects are colliding.</p>
<p><strong>How&#8217;s it work?</strong></p>
<p>It can be achieved any number of ways. Generally speaking, there are two ways of accomplishing this.</p>
<p>The first is the most basic, and limited, and it is to check whether or not two objects are colliding by comparing the coordinates of their bounding boxes, and determining if they overlap. The reason this is limiting is, the default bounding box of a MovieClip is a square, so if you have a non rectangular-shaped movie clip, this type of hit detection may detect a &#8220;hit&#8221; even if the clip isn&#8217;t visually colliding with the compared clip.</p>
<div id="attachment_83" class="wp-caption alignnone" style="width: 158px"><a href="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/09/bounding_box.gif"><img class="size-full wp-image-83" title="bounding_box" src="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/09/bounding_box.gif" alt="Bounding Box Example" width="148" height="147" /></a><p class="wp-caption-text">Bounding Box</p></div>
<p>The second, is to use GCollision, a static ActionScript 3.0 Utility class written by Grant Skinner. The above example swf is created using the GCollision hit detection class. What&#8217;s nice about this class, is it using true, pixel to pixel, hit detection. In a nutshell, the way it works, is the two clips are converted to bitmaps with opposing colors, a ColorTransform is applied to the bitmap, resulting in a bitmap that shows one of the clips entirely red, the other entirely green, and colliding pixels (if there are any) in yellow. If there is even a pixel of yellow in the resulting image, then collision has occurred.</p>
<p>So lets all say thanks GSkinner!</p>
<p>Get the source example <a title="GCollision Example Source" href="../wp-content/uploads/2009/09/gcollision.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jpdevries.com/classes/su09/wdim261/2009/09/13/as-3-hit-detection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash&#8217;s Ancestor</title>
		<link>http://jpdevries.com/classes/su09/wdim261/2009/09/03/flashs-ancestor/</link>
		<comments>http://jpdevries.com/classes/su09/wdim261/2009/09/03/flashs-ancestor/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 22:09:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jpdevries.com/classes/su09/wdim261/?p=72</guid>
		<description><![CDATA[Check out this video that Nick shared, really cool&#8230; multitouch input, auto-correction of vector strokes, and even reusable symbols (a la Flash, Illustrator, etc.) Read more here.
]]></description>
			<content:encoded><![CDATA[<p>Check out this video that Nick shared, really cool&#8230; multitouch input, auto-correction of vector strokes, and even reusable symbols (a la Flash, Illustrator, etc.) Read more <a href="http://blogs.adobe.com/jnack/2009/08/vector_graphics_software_from_1963.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jpdevries.com/classes/su09/wdim261/2009/09/03/flashs-ancestor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Skillset 6</title>
		<link>http://jpdevries.com/classes/su09/wdim261/2009/09/02/skillset-6/</link>
		<comments>http://jpdevries.com/classes/su09/wdim261/2009/09/02/skillset-6/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 19:02:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jpdevries.com/classes/su09/wdim261/?p=70</guid>
		<description><![CDATA[Get the Skillset 6 handout here.
]]></description>
			<content:encoded><![CDATA[<p>Get the Skillset 6 handout <a href="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/09/skillset_6.pdf">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jpdevries.com/classes/su09/wdim261/2009/09/02/skillset-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Circle Loader Tutorial</title>
		<link>http://jpdevries.com/classes/su09/wdim261/2009/08/26/circle-loader-tutorial/</link>
		<comments>http://jpdevries.com/classes/su09/wdim261/2009/08/26/circle-loader-tutorial/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 00:44:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://jpdevries.com/classes/su09/wdim261/?p=62</guid>
		<description><![CDATA[So you wanna make a circle loader huh? Here&#8217;s a preview&#8230; Will be updating this post soon.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_circle_loader_1057991548"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/08/circle_loader.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/08/circle_loader.swf"
			name="fm_circle_loader_1057991548"
			width="550"
			height="400">
	<!--<![endif]-->
		


	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></description>
			<content:encoded><![CDATA[<p>So you wanna make a circle loader huh? Here&#8217;s a preview&#8230; Will be updating this post soon.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_circle_loader_872453128"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/08/circle_loader.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/08/circle_loader.swf"
			name="fm_circle_loader_872453128"
			width="550"
			height="400">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://jpdevries.com/classes/su09/wdim261/2009/08/26/circle-loader-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ArrayUtils Documentation</title>
		<link>http://jpdevries.com/classes/su09/wdim261/2009/08/26/arrayutils-documentation/</link>
		<comments>http://jpdevries.com/classes/su09/wdim261/2009/08/26/arrayutils-documentation/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 23:27:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Assignment]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[week 7]]></category>

		<guid isPermaLink="false">http://jpdevries.com/classes/su09/wdim261/?p=59</guid>
		<description><![CDATA[Check out the ArrayUtils Documentation here. The methods you need to recreate are:
swapElements()
vacateElements()
shuffle()
deDupe()
Feel free to post questions to this thread.
]]></description>
			<content:encoded><![CDATA[<p>Check out the ArrayUtils Documentation <a href="http://jpdevries.com/trycatch/html/com_trycatch_utils_ArrayUtils.html">here</a>. The methods you need to recreate are:<br />
<a href="http://jpdevries.com/trycatch/html/com_trycatch_utils_ArrayUtils.html#swapElements">swapElements()</a><br />
<a href="http://jpdevries.com/trycatch/html/com_trycatch_utils_ArrayUtils.html#vacateElements">vacateElements()</a><br />
<a href="http://jpdevries.com/trycatch/html/com_trycatch_utils_ArrayUtils.html#shuffle">shuffle()</a><br />
<a href="http://jpdevries.com/trycatch/html/com_trycatch_utils_ArrayUtils.html#deDupe">deDupe()</a></p>
<p>Feel free to post questions to this thread.</p>
]]></content:encoded>
			<wfw:commentRss>http://jpdevries.com/classes/su09/wdim261/2009/08/26/arrayutils-documentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Week 6 In Class DisplayObject Example</title>
		<link>http://jpdevries.com/classes/su09/wdim261/2009/08/25/week-6-in-class-displayobject-example/</link>
		<comments>http://jpdevries.com/classes/su09/wdim261/2009/08/25/week-6-in-class-displayobject-example/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 18:02:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[In Class]]></category>
		<category><![CDATA[displaylist]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[week6]]></category>

		<guid isPermaLink="false">http://jpdevries.com/classes/su09/wdim261/?p=45</guid>
		<description><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_shapeSetChild_1013518510"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/08/shapeSetChild.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/08/shapeSetChild.swf"
			name="fm_shapeSetChild_1013518510"
			width="550"
			height="400">
	<!--<![endif]-->
		


	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
Drag the shapes around, notice that Double Clicking a shape brings it to the top of the DisplayList. Get the files for this example here.

blueRect.buttonMode = yellowCircle.buttonMode = redTriangle.buttonMode = true;
blueRect.doubleClickEnabled = yellowCircle.doubleClickEnabled = redTriangle.doubleClickEnabled = true;

blueRect.addEventListener(MouseEvent.MOUSE_DOWN, handleShapeClicked);
yellowCircle.addEventListener(MouseEvent.MOUSE_DOWN, handleShapeClicked);
redTriangle.addEventListener(MouseEvent.MOUSE_DOWN, handleShapeClicked);

blueRect.addEventListener(MouseEvent.MOUSE_UP, handleShapeReleased);
yellowCircle.addEventListener(MouseEvent.MOUSE_UP, handleShapeReleased);
redTriangle.addEventListener(MouseEvent.MOUSE_UP, handleShapeReleased);

blueRect.addEventListener(MouseEvent.DOUBLE_CLICK, handleShapeDoubleClick);
yellowCircle.addEventListener(MouseEvent.DOUBLE_CLICK, handleShapeDoubleClick);
redTriangle.addEventListener(MouseEvent.DOUBLE_CLICK, handleShapeDoubleClick);

function handleShapeDoubleClick(e:MouseEvent) : void [...]]]></description>
			<content:encoded><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_shapeSetChild_1736229448"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/08/shapeSetChild.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/08/shapeSetChild.swf"
			name="fm_shapeSetChild_1736229448"
			width="550"
			height="400">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
Drag the shapes around, notice that Double Clicking a shape brings it to the top of the DisplayList. Get the files for this example <a href="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/08/shapeSetChild.zip">here</a>.</p>
<pre name="code" class="js">
blueRect.buttonMode = yellowCircle.buttonMode = redTriangle.buttonMode = true;
blueRect.doubleClickEnabled = yellowCircle.doubleClickEnabled = redTriangle.doubleClickEnabled = true;

blueRect.addEventListener(MouseEvent.MOUSE_DOWN, handleShapeClicked);
yellowCircle.addEventListener(MouseEvent.MOUSE_DOWN, handleShapeClicked);
redTriangle.addEventListener(MouseEvent.MOUSE_DOWN, handleShapeClicked);

blueRect.addEventListener(MouseEvent.MOUSE_UP, handleShapeReleased);
yellowCircle.addEventListener(MouseEvent.MOUSE_UP, handleShapeReleased);
redTriangle.addEventListener(MouseEvent.MOUSE_UP, handleShapeReleased);

blueRect.addEventListener(MouseEvent.DOUBLE_CLICK, handleShapeDoubleClick);
yellowCircle.addEventListener(MouseEvent.DOUBLE_CLICK, handleShapeDoubleClick);
redTriangle.addEventListener(MouseEvent.DOUBLE_CLICK, handleShapeDoubleClick);

function handleShapeDoubleClick(e:MouseEvent) : void {
	trace("handleShapeDoubleClick");
	var clickedShape:MovieClip = e.currentTarget as MovieClip;
	setChildIndex(clickedShape,numChildren-1);
}

function handleShapeClicked(e:MouseEvent) : void {
	var clickedShape:MovieClip = e.currentTarget as MovieClip;
	clickedShape.startDrag(false);
}

function handleShapeReleased(e:MouseEvent) : void {
	var clickedShape:MovieClip = e.currentTarget as MovieClip;
	clickedShape.stopDrag();
}
</pre>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_shapeSetChildCreate_2142302320"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/08/shapeSetChildCreate.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/08/shapeSetChildCreate.swf"
			name="fm_shapeSetChildCreate_2142302320"
			width="550"
			height="400">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
In this example, clicking on a rectangle button on the left will create a new randomly generated shape. Notice that as in the example above, double clicking any shape will move it to the top of the DisplayList.<br />
The red rectangle in the bottom left will clear all the shapes off the stage (clears the DisplayList).<br />
Notice that as the randomly generated shapes are created and are moved around, they remain beneath the create buttons on the right and the clear button on the bottom left. This is done by adding the randomly generated shapes to a Sprite instance&#8217;s DisplayList that is created and placed beneath the other clips on the stage, rather than adding them directly to the stage itself.</p>
<pre name="code" class="js">
blueRect.buttonMode = yellowCircle.buttonMode = redTriangle.buttonMode = clearBtn.buttonMode = true;
blueRect.doubleClickEnabled = yellowCircle.doubleClickEnabled = redTriangle.doubleClickEnabled = true;

blueRect.addEventListener(MouseEvent.MOUSE_DOWN, handleShapeClicked);
yellowCircle.addEventListener(MouseEvent.MOUSE_DOWN, handleShapeClicked);
redTriangle.addEventListener(MouseEvent.MOUSE_DOWN, handleShapeClicked);

blueRect.addEventListener(MouseEvent.MOUSE_UP, handleShapeReleased);
yellowCircle.addEventListener(MouseEvent.MOUSE_UP, handleShapeReleased);
redTriangle.addEventListener(MouseEvent.MOUSE_UP, handleShapeReleased);

blueRect.addEventListener(MouseEvent.DOUBLE_CLICK, handleShapeDoubleClick);
yellowCircle.addEventListener(MouseEvent.DOUBLE_CLICK, handleShapeDoubleClick);
redTriangle.addEventListener(MouseEvent.DOUBLE_CLICK, handleShapeDoubleClick);

createCircleBtn.addEventListener(MouseEvent.MOUSE_UP, handleCreateClicked);
createRectBtn.addEventListener(MouseEvent.MOUSE_UP, handleCreateClicked);
createTriangleBtn.addEventListener(MouseEvent.MOUSE_UP, handleCreateClicked);

clearBtn.addEventListener(MouseEvent.MOUSE_UP, handleClearClicked);

var shapeHolder:Sprite = new Sprite();
removeChild(blueRect);
removeChild(yellowCircle);
removeChild(redTriangle);

shapeHolder.addChild(blueRect);
shapeHolder.addChild(yellowCircle);
shapeHolder.addChild(redTriangle);

addChildAt(shapeHolder,0);

function get randomX() : Number {
	return Math.random() * stage.stageWidth;
}

function get randomY() : Number {
	return Math.random() * stage.stageHeight;
}

function get randomColor() : Number {
	return Math.random() * 0xFFFFFF;
}

function randomRange(min:Number, max:Number) : Number {
	var _dif:Number = max - min;
	return min + Math.random() * _dif;
}

function handleClearClicked(e:MouseEvent) : void {
	while(shapeHolder.numChildren) shapeHolder.removeChildAt(0);
}

function handleCreateClicked(e:MouseEvent) : void {
	var clickedCreateBtn:MovieClip = e.currentTarget as MovieClip;

	var shapeSprite:Sprite = new Sprite();
	shapeSprite.graphics.beginFill(randomColor);

	switch(clickedCreateBtn) {
		case createCircleBtn:
		shapeSprite.graphics.drawCircle(randomX, randomY, Math.random() * 50);
		break;

		case createRectBtn:
		shapeSprite.graphics.drawRect(randomX, randomY, randomRange(10,100), randomRange(10, 100));
		break;

		case createTriangleBtn:
		var vertices:Vector.<Number> = new Vector.<Number>();
		vertices.push(randomX,randomY,randomX,randomY,randomX,randomY);
		shapeSprite.graphics.drawTriangles(vertices);
		break;
	}

	shapeSprite.buttonMode = shapeSprite.doubleClickEnabled = true;

	shapeSprite.addEventListener(MouseEvent.MOUSE_DOWN, handleShapeClicked);
	shapeSprite.addEventListener(MouseEvent.MOUSE_UP, handleShapeReleased);
	shapeSprite.addEventListener(MouseEvent.DOUBLE_CLICK, handleShapeDoubleClick);

	shapeHolder.addChild(shapeSprite);
}

function handleShapeDoubleClick(e:MouseEvent) : void {
	var clickedShape:Sprite = e.currentTarget as Sprite;
	shapeHolder.setChildIndex(clickedShape,shapeHolder.numChildren-1);
}

function handleShapeClicked(e:MouseEvent) : void {
	var clickedShape:Sprite = e.currentTarget as Sprite;
	clickedShape.startDrag(false);
}

function handleShapeReleased(e:MouseEvent) : void {
	var clickedShape:Sprite = e.currentTarget as Sprite;
	clickedShape.stopDrag();
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jpdevries.com/classes/su09/wdim261/2009/08/25/week-6-in-class-displayobject-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Skillset 5</title>
		<link>http://jpdevries.com/classes/su09/wdim261/2009/08/24/skillset-5/</link>
		<comments>http://jpdevries.com/classes/su09/wdim261/2009/08/24/skillset-5/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 22:21:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jpdevries.com/classes/su09/wdim261/?p=41</guid>
		<description><![CDATA[Get the handout for the Skillset 5 assignment here.
]]></description>
			<content:encoded><![CDATA[<p>Get the handout for the Skillset 5 assignment <a href="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/08/skillset_5.pdf">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jpdevries.com/classes/su09/wdim261/2009/08/24/skillset-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Skillset 4</title>
		<link>http://jpdevries.com/classes/su09/wdim261/2009/08/24/skillset-4/</link>
		<comments>http://jpdevries.com/classes/su09/wdim261/2009/08/24/skillset-4/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 22:20:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Assignment]]></category>

		<guid isPermaLink="false">http://jpdevries.com/classes/su09/wdim261/?p=38</guid>
		<description><![CDATA[Get the handout for the Skillset 4 assignment here.
]]></description>
			<content:encoded><![CDATA[<p>Get the handout for the Skillset 4 assignment <a href="http://jpdevries.com/classes/su09/wdim261/wp-content/uploads/2009/08/skillset_4.pdf">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jpdevries.com/classes/su09/wdim261/2009/08/24/skillset-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
