<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>{ P I X E L W E L D E R S }</title>
	<link>http://pixelwelders.com/blog</link>
	<description>Flash + Flex + Game Dev + Grammar?</description>
	<pubDate>Wed, 11 Mar 2009 14:57:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>ASIDE- Thru-You</title>
		<link>http://pixelwelders.com/blog/asides/2009/aside-thru-you/</link>
		<comments>http://pixelwelders.com/blog/asides/2009/aside-thru-you/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 14:54:26 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[Asides]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/miscellanea/2009/aside-thru-you/</guid>
		<description><![CDATA[If you have even a passing interest in great music and social media, take a look at Thru-You.  Holy crap.
]]></description>
			<content:encoded><![CDATA[<p>If you have even a passing interest in great music and social media, take a look at <a href="http://thru-you.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://thru-you.com/');">Thru-You</a>.  Holy crap.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/asides/2009/aside-thru-you/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Barebones! - AS3 Skeletal Animation System</title>
		<link>http://pixelwelders.com/blog/game-design/2008/barebones-as3-skeletal-animation-system/</link>
		<comments>http://pixelwelders.com/blog/game-design/2008/barebones-as3-skeletal-animation-system/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 14:18:04 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Game Design]]></category>

		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/game-design/2008/barebones-as3-skeletal-animation-system/</guid>
		<description><![CDATA[I&#8217;ve been spending a lot of time lately working on a fighting game for a client.  It&#8217;s pretty standard Street Fighter fare, only much simplified due to time and budget restrictions.  However, it made me start thinking about the limitations of the old 2D fighters and what a more powerful processor, faster graphics, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been spending a lot of time lately working on a fighting game for a client.  It&#8217;s pretty standard Street Fighter fare, only much simplified due to time and budget restrictions.  However, it made me start thinking about the limitations of the old 2D fighters and what a more powerful processor, faster graphics, and a WYSIWYG animation editor could do for them.  I went to my lab immediately.</p>
<p>The first thing I wanted to know was, is there a way to make an animation that can be shared among characters in a game?  And could characters be &#8220;skinned,&#8221; so the same character could change appearances, add/remove body parts or attachments, etc. and retain the same animations?  I see it all the time in big-budget 3D games; each character has a skeleton, to which animations may be applied.  Each animation can be applied to any character, and each character can use any 3D character model (each of which can of course be &#8220;skinned&#8221;).  So you have three components in the system:</p>
<ul>
<li>Skeleton</li>
<li>Animation</li>
<li>Skin</li>
</ul>
<p>Never having been involved with a big-budget game, I can&#8217;t tell you the best way to design a system like that.  However, as a Flash developer, I <em>can</em> find a good way to do it in 2D, in your browser.</p>

<object	type="application/x-shockwave-flash"
			data="http://pixelwelders.com/experiments/barebones/v3/barebones.swf"
			width="750"
			height="300">
	<param name="movie" value="http://pixelwelders.com/experiments/barebones/v3/barebones.swf" />
</object>
<p>This is a quick example of the system (v0.1) in action.  This looks like a timeline animation, but it&#8217;s actually done with code.  To prove it, click the stage to toggle the animation speed.  Notice that it slows down to &#8220;bullet time,&#8221; but totally smoothly, without the jerkiness of a frame-based animation going down to 3 fps.  Also, because of how the system is designed, it can be combined with a physics engine (Box2D, for example) for ragdoll falls from any point in the animation.  Think of the possibilities!</p>
<p>Anyway, just wanted to put that out there.  I&#8217;ve got a couple projects in line first, but I&#8217;d like to explore this further to see what kind of gameplay could come of it.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/game-design/2008/barebones-as3-skeletal-animation-system/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flash/Flex Integration: SWFLibrary v1.5</title>
		<link>http://pixelwelders.com/blog/best-practices/2008/flashflex-integration-swflibrary-v15/</link>
		<comments>http://pixelwelders.com/blog/best-practices/2008/flashflex-integration-swflibrary-v15/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 01:28:48 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Best Practices]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Actionscript]]></category>

		<category><![CDATA[Flash/Flex Integration]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/best-practices/2008/flashflex-integration-swflibrary-v15/</guid>
		<description><![CDATA[
Usually I like to post glamorous stuff, like 3D swirly things and experiments.  Occasionally, however, I feel the need to release a little code in the interest of helping a few people out.  This code is a review of sorts, since I already posted a similar utility back in June.  However, since [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://pixelwelders.com/blog/wp-content/themes/tma/images/latest/SWFLibrary_470x175.jpg"/ style="float:none"></p>
<p>Usually I like to post glamorous stuff, like 3D swirly things and experiments.  Occasionally, however, I feel the need to release a little code in the interest of helping a few people out.  This code is a review of sorts, since I already posted a <a href="http://pixelwelders.com/blog/best-practices/2008/runtime-libraries-in-as3/" >similar utility</a> back in June.  However, since then I have been expanding my code library and I thought I&#8217;d share the latest and much improved version.  It&#8217;s really a simple concept, but having this in my toolbox has lightened my workload as an ActionScripter considerably.</p>
<h3>Advantages</h3>
<p>This utility allows you to publish any symbol from Flash and access it at runtime from an ActionScript-only project, such as in Flex Builder.  This has a few advantages:</p>
<ul>
<li>Easy storage of many assets in one file</li>
<li>Ability to change graphics without recompiling the main application</li>
<li>Faster load times with only one HTTP request (as opposed to many separate images and sounds)</i>
<li>Ability to import vector graphics and animations at runtime</li>
<li>Smaller main SWF size</li>
</ul>
<p>The one disadvantage that I can think of is that you&#8217;ll need to recompile your library SWF every time you make a change.  However, I think the advantages above outweigh this.</p>
<h3>Differences in v1.5</h3>
<p>Here are the main differences from the last version:</p>
<ul>
<li>The class is no longer static.  This allows for more than one instance of SWFLibrary at a time.</li>
<li>The class can now return instances of Sprites, MovieClips, and Sounds from a library SWF.</li>
</ul>
<h3>Usage</h3>
<p>1 - In Flash, select &#8220;Export for ActionScript&#8221; in the symbol&#8217;s Linkage settings in the Library (ex. &#8216;Character&#8217;).<br />
2 - Publish the Flash file as a SWF.<br />
3 - Load the SWF into an instance of SWFLibrary<br />
4 - Access the symbol through SWFLibrary, using the class name chosen in Step 1.</p>
<p>A SWFLibrary can be used with four lines of code.  Here&#8217;s what you&#8217;ll need:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span style="color: #808080; font-style: italic;">// creates an instance of SWFLibrary, adds a listener, and loads a SWF</span>
<span style="color: #000000; font-weight: bold;">var</span> gameAssets:SWFLibrary = <span style="color: #000000; font-weight: bold;">new</span> SWFLibrary
gameAssets.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">COMPLETE</span>, handleAssetsLoaded <span style="color: #66cc66;">&#41;</span>;
gameAssets.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;myCustomGameAssets.swf&quot;</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// accesses the asset (assumes there is a symbol exported as 'Character' in the loaded SWF, as seen in step 1 above)</span>
<span style="color: #808080; font-style: italic;">// this code should run after the Event above has fired</span>
<span style="color: #000000; font-weight: bold;">var</span> mySprite:Sprite = gameAssets.<span style="color: #006600;">getSprite</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;Character&quot;</span> <span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span> mySprite <span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// gets the asset as a MovieClip (assuming, of course, that it actually is a movieclip)</span>
<span style="color: #000000; font-weight: bold;">var</span> myMC:<span style="color: #0066CC;">MovieClip</span> = gameAssets.<span style="color: #006600;">getSprite</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;Character&quot;</span> <span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span> myMC <span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// getting a sound</span>
<span style="color: #000000; font-weight: bold;">var</span> mySound:<span style="color: #0066CC;">Sound</span> = gameAssets.<span style="color: #006600;">getSound</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;SoundLinkageNameHere&quot;</span> <span style="color: #66cc66;">&#41;</span>;
mySound.<span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// === ===</span></pre></div></div>

<p>After a symbol has been retrieved from SWFLibrary, it may be treated like any other object.</p>
<h3>Download</h3>
<p><a href="http://pixelwelders.com/open_source/SWFLibrary/SWFLibrary.zip" onclick="javascript:pageTracker._trackPageview('/downloads/open_source/SWFLibrary/SWFLibrary.zip');">DOWNLOAD SOURCE</a></p>
<p>So have fun with this.  Hopefully it saves you as much time as it saves me.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/best-practices/2008/flashflex-integration-swflibrary-v15/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Presenting: Tutorio.us!</title>
		<link>http://pixelwelders.com/blog/best-practices/2008/presenting-tutorious/</link>
		<comments>http://pixelwelders.com/blog/best-practices/2008/presenting-tutorious/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 18:20:18 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[Best Practices]]></category>

		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/best-practices/2008/presenting-tutorious/</guid>
		<description><![CDATA[After a couple of months working on this project, I am ready to release my labor of love.  Presenting: Tutorio.us!]]></description>
			<content:encoded><![CDATA[<p>After a couple of months working on this project, I am ready to release my labor of love.  Presenting: Tutorio.us!</p>
<p><a href="http://tutorio.us"><br />
<img style="float:none;" src='http://pixelwelders.com/blog/wp-content/uploads/2008/07/logo2_500.jpg' alt='Tutorious Logo' /><br />
</a></p>
<p>To explain what this is, and instead of writing something new, I&#8217;ll just quote directly directly from the website:</p>
<div style="background:#eee; padding:15px;">
<h3>The Scenario</h3>
<p>So you want to learn Flash. Great! A noble endeavor. And you want to do it on your own, harnessing the vast resources of the internet. Also a good idea, with only one problem: which resources?</p>
<p>The Internet is a vast place. According to <a href="http://adamant.typepad.com/seitz/2007/04/weighing_the_we.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://adamant.typepad.com/seitz/2007/04/weighing_the_we.html');">some estimates</a>, it contains nearly two ounces of information (which is more than you think when you’re counting electrons). If that doesn’t awe you, consider <a href="http://blog.managednetworks.co.uk/it-support/googles-20-petabytes/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://blog.managednetworks.co.uk/it-support/googles-20-petabytes/');">this article</a>, which tells us that if a byte is a grain of rice, Google processes enough rice daily for every person on earth to have sixteen bowls full. <em>Daily</em>.</p>
<h3>The Problem</h3>
<p>The main point is this: there is a lot of information out there. There is more than enough to teach you everything you want to know about Flash. If you’ve spent any time searching, you’ve probably seen hundreds of tutorials already- maybe dozens today alone. However, the problem is this: a lot of them kinda suck. You’ve probably noticed this too. Incorrect information, bad (even crippling) practices, ancient Flash versions… the list goes on.</p>
<p>The second problem is this: If you’re new to ActionScript, what do you learn first? XML? Text formatting? Class structure? And where do you go after that? What are the pre-requisites of each tutorial? All this knowledge is out there (somewhere in that two ounces of electrons) but the majority of it is alone, without context, floating in the void.</p>
<h3>The Solution</h3>
<p>So here’s our solution. Tutorio.us is our attempt to index the best Flash instruction on the Internet, in a context that makes sense. We are dedicated to finding the clearest, best-written content for the most cutting-edge technology and putting it together in ways that everyone can understand.
</p></div>
<p><br/><br />
So there you have it.  Go take a look and let me know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/best-practices/2008/presenting-tutorious/feed/</wfw:commentRss>
		</item>
		<item>
		<title>FIVe3D Custom Primitive: VectorCube Class</title>
		<link>http://pixelwelders.com/blog/actionscript-3/2008/five3d-custom-primitive-vectorcube-class/</link>
		<comments>http://pixelwelders.com/blog/actionscript-3/2008/five3d-custom-primitive-vectorcube-class/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 22:48:09 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[3D]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Featured]]></category>

		<category><![CDATA[FIVe3D]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/actionscript-3/2008/five3d-custom-primitive-vectorcube-class/</guid>
		<description><![CDATA[After a long Papervision-induced hiatus, I've come back to FIVe3D- mainly because I still think it's a great library.  Since it's still relatively new, however, there's not a lot of example code out there.  Thus, here's another chunk from your friends here at Pixelwelders.]]></description>
			<content:encoded><![CDATA[<p>After a long Papervision-induced hiatus, I&#8217;ve come back to FIVe3D- mainly because I still think it&#8217;s a great library.  Since it&#8217;s still relatively new, however, there&#8217;s not a lot of example code out there.  Thus, here&#8217;s another chunk from your friends here at Pixelwelders.  This class creates a cube out of Sprite3D planes.</p>
<h3>Fig. 1: 27 Cubes</h3>

<object	type="application/x-shockwave-flash"
			data="http://pixelwelders.com/experiments/FIVe3D_cube/RubiksCube.swf"
			width="700"
			height="450">
	<param name="movie" value="http://pixelwelders.com/experiments/FIVe3D_cube/RubiksCube.swf" />
</object>
<h3>Fig.2: The VectorCube Class</h3>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span style="color: #808080; font-style: italic;">/**
 * A vector Cube class for Mathieu Badimon's excellent FIVe3D library
 * @author Zack Jordan
 * { P I X E L W E L D E R S . C O M }
 */</span>
package com.<span style="color: #006600;">pixelwelders</span>.<span style="color: #006600;">five3d</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> five3D.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite3D</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> VectorCube <span style="color: #0066CC;">extends</span> Sprite3D
	<span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> faces		: <span style="color: #0066CC;">Array</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> VectorCube<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">size</span>:<span style="color: #0066CC;">Number</span>, colors:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">!</span>colors <span style="color: #66cc66;">&#41;</span> colors = <span style="color: #66cc66;">&#91;</span> 0xFF0000, 0xFF0000, 0xFF0000, 0xFF0000, 0xFF0000, 0xFF0000 <span style="color: #66cc66;">&#93;</span>;
			createCube<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">size</span>, colors <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">/**
		 * Creates a new cube at the size specified
		 * 
		 * @param		size			Size of the cube to be created
		 * @return					The new cube
		 */</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createCube<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">size</span>:<span style="color: #0066CC;">Number</span>, colors:<span style="color: #0066CC;">Array</span> <span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			faces = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> xP:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span>	<span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>,	<span style="color: #cc66cc;">0</span>, -<span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> yP:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span>	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>,	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>,	-<span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, <span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> zP:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span>	-<span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>	<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> xR:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span>	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>,	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">-90</span>, <span style="color: #cc66cc;">90</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> yR:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span>	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">-90</span>, <span style="color: #cc66cc;">180</span>, <span style="color: #cc66cc;">90</span>,	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> zR:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span>	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>,	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">6</span>; i++ <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> face:Sprite3D = <span style="color: #000000; font-weight: bold;">new</span> Sprite3D<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				face.<span style="color: #006600;">graphics3D</span>.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">1</span>, 0x000000, <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span>;
				face.<span style="color: #006600;">graphics3D</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span> colors<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;
				face.<span style="color: #006600;">graphics3D</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span> -<span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, -<span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, <span style="color: #0066CC;">size</span>, <span style="color: #0066CC;">size</span> <span style="color: #66cc66;">&#41;</span>;
				face.<span style="color: #006600;">graphics3D</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				face.<span style="color: #006600;">singleSided</span> = <span style="color: #000000; font-weight: bold;">true</span>;
&nbsp;
				face.<span style="color: #006600;">x</span> = xP<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span>;
				face.<span style="color: #006600;">y</span> = yP<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span>;
				face.<span style="color: #006600;">z</span> = zP<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span>;
				face.<span style="color: #006600;">rotationX</span> = xR<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span>;
				face.<span style="color: #006600;">rotationY</span> = yR<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span>;
				face.<span style="color: #006600;">rotationZ</span> = zR<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span>;
&nbsp;
				faces<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span> = face;
				addChild<span style="color: #66cc66;">&#40;</span> face <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>So what is this good for?  Really, it&#8217;s just an easy way to create six faces and arrange them into a cube.  You don&#8217;t have to worry about depth sorting or any of that stuff because each of the faces is one-sided.  However, if you are using more than one of these in your presentation, make sure you specify that <code>container.childrenSorted = true</code>, where <code>container</code> is the Sprite3D containing your Cubes.  Otherwise you&#8217;ll get some weird results.</p>
<p>Another note: the <code>faces</code> Array is public so you can continue to draw on each face of the cube, and even add children.  So really, this is just a starting point; I&#8217;ll let you find something useful to do with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/actionscript-3/2008/five3d-custom-primitive-vectorcube-class/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Pokervision3D</title>
		<link>http://pixelwelders.com/blog/game-design/2008/pokervision3d/</link>
		<comments>http://pixelwelders.com/blog/game-design/2008/pokervision3d/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 13:34:51 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[3D]]></category>

		<category><![CDATA[Game Design]]></category>

		<category><![CDATA[Papervision3D]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/game-design/2008/pokervision3d/</guid>
		<description><![CDATA[I just spent the last three weeks a little bit out of the action, wandering Europe in a motorcoach.  On said motorcoach, there were only two things to do: play with my laptop, and play poker with the other passengers.  By the end of the trip, I ended up winning about thirty Euros [...]]]></description>
			<content:encoded><![CDATA[<p>I just spent the last three weeks a little bit out of the action, wandering Europe in a motorcoach.  On said motorcoach, there were only two things to do: play with my laptop, and play poker with the other passengers.  By the end of the trip, I ended up winning about thirty Euros from my playing partners (most of which were 17 and younger).  Obviously, I have no ethical qualms about gambling with minors.  The only thing that disturbed me about this scenario was the fact that 30 Euros is pocket money in France and practically a mortgage payment in the US.  Stupid dollar.</p>
<p>So between games, I started this little project in Papervision.  I&#8217;m not sure how far I&#8217;ll take it, but it might end up being my entry into the <a href="http://blog.papervision3d.org/2008/07/02/paperking3d-the-papervision3d-contest/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://blog.papervision3d.org/2008/07/02/paperking3d-the-papervision3d-contest/');">PaperKing3D</a> contest.  I found some great images of a Victorian-style deck of cards, and painstakingly clone-brushed a full deck out of the few cards I could find.  I then put together the actual game&#8211; which is obviously not finished.  However, it does actually deal out the cards and keep track of players- the next step is to actually make it judge hands (flush vs. full house, etc.).</p>
<p>The best part of this little demo is what happens when you mouse over your cards (the closest hand).  That is Bartek Drozdz&#8217;s <a href="http://www.everydayflash.com/blog/index.php/2008/06/16/bend-modifier-papervision3d-2/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.everydayflash.com/blog/index.php/2008/06/16/bend-modifier-papervision3d-2/');">bend modifier</a> in action.  I think it&#8217;s pretty eye-catching.</p>

<object	type="application/x-shockwave-flash"
			data="http://pixelwelders.com/games/Pokervision3D/Flex/Pokervision_UI.swf"
			width="700"
			height="550">
	<param name="movie" value="http://pixelwelders.com/games/Pokervision3D/Flex/Pokervision_UI.swf" />
</object>
<p><br/><br />
Anyway, that&#8217;s it on Pokervision for today; hopefully I&#8217;ll have the time to finish this (multiplayer 3D poker, anyone?).  In the meantime, I&#8217;ll be working on another, possibly more awesome project that I&#8217;ll be presenting at tomorrow&#8217;s <a href="http://flash.meetup.com/11/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://flash.meetup.com/11/');">Chicago Flash Meetup</a>.  I&#8217;ll post more details here later this week.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/game-design/2008/pokervision3d/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Speed Tests: Objects vs. Arrays vs. Dictionaries</title>
		<link>http://pixelwelders.com/blog/best-practices/2008/speed-tests-objects-vs-arrays-vs-dictionaries/</link>
		<comments>http://pixelwelders.com/blog/best-practices/2008/speed-tests-objects-vs-arrays-vs-dictionaries/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 09:27:12 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Best Practices]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/best-practices/2008/speed-tests-objects-vs-arrays-vs-dictionaries/</guid>
		<description><![CDATA[	I’ve been taking buses around Europe for a couple weeks now, and sometimes those trips get extremely long.  Yesterday I took a bus from Venice to Seefeld (Austria), a trip that would have taken about five hours if not for the hurricane-like downpour they were having in Italy.  Seriously, it was ridiculous- all traffic was on the side of the highway, and all the motorcyclists were huddled under the overpasses.  But on the bright side, it did give me a lot of time to try out some things that I normally wouldn’t take the time to do, such as this experiment.]]></description>
			<content:encoded><![CDATA[<p>	I’ve been taking buses around Europe for a couple weeks now, and sometimes those trips get extremely long.  Yesterday I took a bus from Venice to Seefeld (Austria), a trip that would have taken about five hours if not for the hurricane-like downpour they were having in Italy.  Seriously, it was ridiculous- all traffic was on the side of the highway, and all the motorcyclists were huddled under the overpasses.  But on the bright side, it did give me a lot of time to try out some things that I normally wouldn’t take the time to do, such as this experiment.</p>
<p>	I make a lot of decisions daily based on things I think I know, but really have just always assumed.  And so, on this bus ride, I decided to get to the bottom of a few of them.  The first experiment I tried was with the read and write speeds of Objects, Arrays, and Dictionaries.  In the past, I have always used Arrays when I need all the nifty sorting and organization methods, Dictionaries when I need fast access, object keys, or weak references, and Objects pretty much never (because they’re messy and slow).  So yesterday I decided to see if my assumptions were actually valid, or if I had been doing things wrong this whole time.</p>
<p>	So I set up a quick class to test.  I created a Dictionary, an Object, and an Array, and then I put 100,000 integers in each one for the write test, and read them back out for the read test.  This is what I got (all times are average and in milliseconds).</p>
<table>
<tr>
<th/>
<th>Object</th>
<th>Array</th>
<th>Dictionary</th>
</tr>
<tr>
<th>Read (integer key)</th
<td>868</td>
<td>19</td>
<td>573</td>
</tr>
<tr>
<th>Write (integer key)</th>
<td>24</td>
<td>17</td>
<td>22</td>
</tr>
<tr>
<th>Read (string key)</th>
<td>586</td>
<td>N/A</td>
<td>573</td>
</tr>
<tr>
<th>Write (string key)</th>
<td>329</td>
<td>N/A</td>
<td>333</td>
</tr>
</table>
<p>	Obviously there are many more benchmarks that I could have run, but I also had a pretty good book on that bus.  I think I’ve done enough experimentation to prove that, once again, my assumptions are invalid.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/best-practices/2008/speed-tests-objects-vs-arrays-vs-dictionaries/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flash + Google = ?</title>
		<link>http://pixelwelders.com/blog/flashosphere/2008/flash-google/</link>
		<comments>http://pixelwelders.com/blog/flashosphere/2008/flash-google/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 18:53:29 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[Flashosphere]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/flashosphere/2008/flash-google/</guid>
		<description><![CDATA[Although we've all heard for years that Google does index SWFs in some mysterious way, no one has really understood exactly what that meant.  All we knew was that it was pretty much useless.  But, if my sources are correct, things may be changing.]]></description>
			<content:encoded><![CDATA[<p><img src="http://pixelwelders.com/blog/wp-content/themes/tma/images/latest/suisse_470x175.jpg" style="float:none"/></p>
<p>Sorry for the lack of updates, everyone: I&#8217;m currently in Switzerland enjoying the fondue (true story).  However, I did stumble across something interesting during my last five-Franc Internet session.  Although we&#8217;ve all heard for years that Google does index SWFs in some mysterious way, no one has really understood exactly what that meant.  All we knew was that it was pretty much useless.  However, it looks like Google is getting a little more serious about it, as mentioned in the links below.</p>
<p>Google&#8217;s blog:<br />
<a href="http://googleblog.blogspot.com/2008/06/google-learns-to-crawl-flash.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://googleblog.blogspot.com/2008/06/google-learns-to-crawl-flash.html');">Google Learns to Crawl Flash</a></p>
<p>Adobe&#8217;s press release:<br />
<a href="http://www.adobe.com/aboutadobe/pressroom/pressreleases/200806/070108AdobeRichMediaSearch.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.adobe.com/aboutadobe/pressroom/pressreleases/200806/070108AdobeRichMediaSearch.html');">Adobe Advances Rich Media Search on the Web</a></p>
<p>However, I still have no idea what this means.  After all, any Flash RIA developer worth his salt will be bringing in all his/her data dynamically instead of embedding it in the SWF.  I would assume this is the data that Google will be reading, non?  Otherwise I&#8217;m not sure how it would be different than what we&#8217;ve got now.  And also because I like to hope for the best, and that would be pretty slick.  Game-changing, I&#8217;d even say.</p>
<p>So anyway, I&#8217;ll leave the in-depth analysis to <a href="http://blogs.zdnet.com/Stewart/?p=871" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://blogs.zdnet.com/Stewart/?p=871');">others</a>.  The Alps, after all, are calling.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/flashosphere/2008/flash-google/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AS3 Broadcaster Class</title>
		<link>http://pixelwelders.com/blog/best-practices/2008/as3-broadcaster-class/</link>
		<comments>http://pixelwelders.com/blog/best-practices/2008/as3-broadcaster-class/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 14:52:31 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Best Practices]]></category>

		<category><![CDATA[AS2 vs AS3]]></category>

		<category><![CDATA[Broadcaster]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/best-practices/2008/as3-broadcaster-class/</guid>
		<description><![CDATA[This is something simple enough that I hesitate to post it, but maybe someone else can benefit.  Plus, I always try to have something new on Mondays.  Anyway, this a technique I once used back in the dark ages of ActionScript development (meaning AS2).  Last week, however, I suddenly had need of it again.]]></description>
			<content:encoded><![CDATA[<p><img src="http://pixelwelders.com/blog/wp-content/themes/tma/images/latest/satellite_470x175.jpg" style="float:none"/></p>
<p>This is something simple enough that I hesitate to post it, but maybe someone else can benefit.  Plus, I always try to have something new on Mondays.  Anyway, this a technique I once used back in the dark ages of ActionScript development (meaning AS2).  Last week, however, I suddenly had need of it again.</p>
<h3>The Scenario</h3>
<p>The AS3 event model is a pretty slick deal- much better than the six different ways we used to do it back in AS2.  However, I ran into a spot last week in which it failed me.  I had several different components in completely different parts of an application, and I wanted them all to listen to each other.  That in itself is no problem.  The problem was that I also wanted them to be completely <em>unaware</em> of each other, in hopes of keeping the code a bit more encapsulated.  So how does one listen for an event that comes from a source whose very existence is unknown?</p>
<h3>Option #1</h3>
<p>Option #1 was to make all my events bubble, and have each component add event listeners to some display list parent that all the components shared.  This would ensure that everyone got their events, but it makes everyone dependent on the current setup.  What if I wanted to move a component elsewhere and now it didn&#8217;t share that parent?  Plus, it&#8217;s not a solution that is guaranteed to work in a different app.  <em>Plus</em>, it involves children referencing their parent, which I am against on a fundamental, perhaps even a <em>spiritual</em> level.  So, scratch Option #1.</p>
<h3>Option #2</h3>
<p>Then I thought maybe each component should store a reference to all the other components.  But once again, you can throw the whole “loosely-coupled” idea out the window.  Something about this solution just didn’t feel right.</p>
<h3>Option #3</h3>
<p>Option #3 was the old AS2 method of creating a central static Broadcaster class and telling everyone to listen to <em>it</em>.  Now the only dependency each component had was to one static communication class.  Everything else could change as long as they were listening to the Broadcaster.  And so, as my great-grandmother has told me, sometimes the old ways are best.</p>
<h3>Source</h3>
<p>There’s really not much to explain with this class.  The only challenge was making a static class into an EventDispatcher, but that turned out to be pretty easy (thanks to <a href="http://gskinner.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://gskinner.com/');">G. Skinner</a>, who originally gave me the idea for a static EventDispatcher).  Behold:</p>
<pre lang=”Actionscript”>
/**
 * A central event broadcaster
 *
 * @author	Zack Jordan
 * 			{ P I X E L W E L D E R S . C O M }
 */
package com.pixelwelders.events
{
	import flash.events.Event;
	import flash.events.EventDispatcher;

	public class Broadcaster
	{

		private static var eventDispatcher			: EventDispatcher;

		/**
		 * Broadcasts an event to all listeners
		 * To listen to any and all events, use Broadcaster.addEventListener()
		 *
		 * @param	event		The Event to broadcast
		 * @return				nothing
		 */
		public static function broadcast( event:Event ): void
		{
			dispatchEvent( event );
		}

		// === S T A T I C   E V E N T   D I S P A T C H E R ===
		public static function addEventListener( type:String, listener:Function, useCapture:Boolean=false,
			priority:int=0, useWeakReference:Boolean=true ):void
		{
			if ( !eventDispatcher ) eventDispatcher = new EventDispatcher();
			eventDispatcher.addEventListener( type, listener, useCapture, priority, useWeakReference );
		}

		public static function removeEventListener( type:String, listener:Function, useCapture:Boolean=false ):void
		{
			if ( eventDispatcher ) eventDispatcher.removeEventListener( type, listener, useCapture );
  	    	}

		public static function dispatchEvent( p_event:Event ):void
		{
			if ( eventDispatcher ) eventDispatcher.dispatchEvent( p_event );
		}

	}
}
</pre>
<p>As you can see, this is just a static wrapper for an instance of EventDispatcher.  I just route all the methods of the EventDispatcher to static methods, and voilá.  As always, if you can think of a better way, just drop it in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/best-practices/2008/as3-broadcaster-class/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Custom Shapes in FIVe3D: The Arc</title>
		<link>http://pixelwelders.com/blog/actionscript-3/2008/custom-shapes-in-five3d-the-arc/</link>
		<comments>http://pixelwelders.com/blog/actionscript-3/2008/custom-shapes-in-five3d-the-arc/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 05:38:24 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[3D]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[FIVe3D]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/actionscript-3/2008/custom-shapes-in-five3d-the-arc/</guid>
		<description><![CDATA[The beauty of FIVe3D (other than its size, ease of use, and a few other things) is how easily extendable it is.  For a <a href="http://pixelwelders.com/blog/actionscript-3/2008/best-five3d-experiment-yet-seriously-its-awesome/">previous experiment</a>, I needed a way to draw an arc in 3D space.  This isn't something that FIVe3D provides, and in fact it was a little challenging to find the math I needed.  However!  Once I found it, I was able to easily use FIVe3D's drawing API to put it into action.]]></description>
			<content:encoded><![CDATA[<p>The beauty of FIVe3D (other than its size, ease of use, and a few other things) is how easily extendable it is.  For a <a href="http://pixelwelders.com/blog/actionscript-3/2008/best-five3d-experiment-yet-seriously-its-awesome/" >previous experiment</a>, I needed a way to draw an arc in 3D space.  This isn&#8217;t something that FIVe3D provides, and in fact it was a little challenging to find the math I needed.  However!  Once I found it, I was able to easily use FIVe3D&#8217;s drawing API to put it into action.  </p>
<p>The arc code, by the way, is from an ancient AS2 function called drawWedge() by Ric Ewing, which drew pizza-style wedges.  Close enough.  With a little elbow grease I managed to bend it to my will.  Here&#8217;s an example of a bunch of arcs doing their thing:</p>

<object	type="application/x-shockwave-flash"
			data="http://pixelwelders.com/experiments/FIVe3D_Arc/FIVe3D_Arc.swf"
			width="750"
			height="400">
	<param name="movie" value="http://pixelwelders.com/experiments/FIVe3D_Arc/FIVe3D_Arc.swf" />
</object>
<p>And here is the code that draws the arc, which extends FIVe3D&#8217;s Drawing class.  This could probably be cleaned up a bit, since I run through Ric&#8217;s arc code twice to create the thing; it wasn&#8217;t originally that way, but getting the fill on the <em>inside</em> of the arc proved more difficult than I originally thought.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span style="color: #808080; font-style: italic;">/**
 * An extension of Mathieu Badimon's FIVe3D Drawing class.
 * This class draws an additional shape onto a FIVe3D Graphics3D instance.
 * This class includes code from by Ric Ewing.
 * 
 * @author 	Zack Jordan
 * 			{ P I X E L W E L D E R S }
 */</span>
package com.<span style="color: #006600;">pixelwelders</span>.<span style="color: #006600;">five3d</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> five3D.<span style="color: #006600;">display</span>.<span style="color: #006600;">Graphics3D</span>;
	<span style="color: #0066CC;">import</span> five3D.<span style="color: #006600;">utils</span>.<span style="color: #006600;">Drawing</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PXWDrawing <span style="color: #0066CC;">extends</span> Drawing
	<span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">/**
		 * Draws a wedge shape onto a Graphics3D instance.
		 * 
		 * @param 	graphics		a Graphics3D instance on which to draw
		 * @param 	x				x position of the center of this wedge
		 * @param	y				y position of the center of this wedge
		 * @param	startAngle		the angle of one straight line of this wedge
		 * @param	arc				the angle (in degrees) of the total arc of this wedge
		 * @param	xRadius			the external radius along the x axis
		 * @param	yRadius			the external radius along the y axis
		 * @param	innerXRadius	the internal radius along the x axis
		 * @param	innerYRadius	the internal radius along the y axis
		 * @param	color			the color of the wedge fill
		 * @param	fillAlpha		the alpha value of the wedge fill
		 * 
		 * @return					nothing
		 */</span>
		<span style="color: #0066CC;">static</span> <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> drawWedge<span style="color: #66cc66;">&#40;</span> 
			graphics:Graphics3D, 
			x:<span style="color: #0066CC;">Number</span>, 
			y:<span style="color: #0066CC;">Number</span>, 
			startAngle:<span style="color: #0066CC;">Number</span>, 
			arc:<span style="color: #0066CC;">Number</span>, 
			xRadius:<span style="color: #0066CC;">Number</span>, 
			yRadius:<span style="color: #0066CC;">Number</span>, 
			innerXRadius:<span style="color: #0066CC;">Number</span>, 
			innerYRadius:<span style="color: #0066CC;">Number</span>, 
			<span style="color: #0066CC;">color</span>:uint = 0xFF0000, 
			fillAlpha:<span style="color: #0066CC;">Number</span> = .<span style="color: #cc66cc;">5</span> 
		<span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> segAngle	: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> theta		: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> angle		: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> angleMid	: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> segs		: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> bx		: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> by		: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> cx		: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> cy		: <span style="color: #0066CC;">Number</span>;
&nbsp;
			segs = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">ceil</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">abs</span><span style="color: #66cc66;">&#40;</span> arc <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">45</span> <span style="color: #66cc66;">&#41;</span>;
			segAngle = arc <span style="color: #66cc66;">/</span> segs;
			theta = -<span style="color: #66cc66;">&#40;</span> segAngle <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span>;
			angle = -<span style="color: #66cc66;">&#40;</span> startAngle <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span>;
&nbsp;
			graphics.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">1</span>, 0x000000, <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span>;
			graphics.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">color</span>, fillAlpha <span style="color: #66cc66;">&#41;</span>;
			graphics.<span style="color: #0066CC;">moveTo</span><span style="color: #66cc66;">&#40;</span> 
				x + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> startAngle <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> innerXRadius,
				y + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> -startAngle<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> innerYRadius 
			<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// line 1</span>
			graphics.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span> 
				x + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> startAngle <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> xRadius,
				y + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> -startAngle <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> yRadius 
			<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// outer arc</span>
			<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> segs; i++ <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				angle += theta;
				angleMid = angle - <span style="color: #66cc66;">&#40;</span> theta <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span>;
				bx = x + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> angle <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> xRadius;
				by = y + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> angle <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> yRadius;
				cx = x + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> angleMid <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span> xRadius <span style="color: #66cc66;">/</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> theta <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
				cy = y + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> angleMid <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span> yRadius <span style="color: #66cc66;">/</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> theta <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
				graphics.<span style="color: #0066CC;">curveTo</span><span style="color: #66cc66;">&#40;</span> cx, cy, bx, by <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #808080; font-style: italic;">// line 2</span>
			graphics.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span> 
				x + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#40;</span> startAngle + arc <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> innerXRadius, 
				y + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> -<span style="color: #66cc66;">&#40;</span> startAngle + arc <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> innerYRadius 
			<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			theta = -<span style="color: #66cc66;">&#40;</span> segAngle <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span>;
			angle = -<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#40;</span> startAngle + arc <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// inner arc</span>
			<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> j:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; j <span style="color: #66cc66;">&lt;</span> segs; j++ <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				angle -= theta;
				angleMid = angle + <span style="color: #66cc66;">&#40;</span> theta <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span>;
				bx = x + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> angle <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> innerXRadius;
				by = y + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> angle <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> innerYRadius;
				cx = x + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> angleMid <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span> innerXRadius <span style="color: #66cc66;">/</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> theta <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
				cy = y + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> angleMid <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span> innerYRadius <span style="color: #66cc66;">/</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> theta <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
				graphics.<span style="color: #0066CC;">curveTo</span><span style="color: #66cc66;">&#40;</span> cx, cy, bx, by <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>			
			graphics.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;			
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>		
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Another note on this experiment: the SWF is 16k.  Holy crap.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/actionscript-3/2008/custom-shapes-in-five3d-the-arc/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
