<?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>Psyked &#187; ActionScript</title>
	<atom:link href="http://www.psyked.co.uk/category/actionscript/feed" rel="self" type="application/rss+xml" />
	<link>http://www.psyked.co.uk</link>
	<description>it's easy once you know how.</description>
	<lastBuildDate>Tue, 09 Mar 2010 08:23:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Link: Computer mind control with ActionScript 3.0</title>
		<link>http://www.psyked.co.uk/actionscript/link-computer-mind-control-with-actionscript-3-0.htm</link>
		<comments>http://www.psyked.co.uk/actionscript/link-computer-mind-control-with-actionscript-3-0.htm#comments</comments>
		<pubDate>Wed, 20 Jan 2010 08:30:32 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[BCI]]></category>
		<category><![CDATA[Mind Control]]></category>

		<guid isPermaLink="false">http://www.psyked.co.uk/?p=1124</guid>
		<description><![CDATA[
This is a very cool experiment &#8211; using a socket in AS3 to interface with Brain Computer Interface (BCI) hardware. Check it out at this url: http://seantheflexguy.com/blog/2009/12/30/neurosky-mindset-brain-computer-interface-actionscript-3-0-api/
]]></description>
			<content:encoded><![CDATA[<p><a href="http://seantheflexguy.com/blog/2009/12/30/neurosky-mindset-brain-computer-interface-actionscript-3-0-api/" target="_blank"><img class="alignnone size-full wp-image-1125" title="Mind control" src="http://www.psyked.co.uk/wp-content/uploads/2010/01/mind-control.jpg" alt="" width="500" height="280" /></a></p>
<p>This is a very cool experiment &#8211; using a socket in AS3 to interface with Brain Computer Interface (BCI) hardware. Check it out at this url: <a href="http://seantheflexguy.com/blog/2009/12/30/neurosky-mindset-brain-computer-interface-actionscript-3-0-api/">http://seantheflexguy.com/blog/2009/12/30/neurosky-mindset-brain-computer-interface-actionscript-3-0-api/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/actionscript/link-computer-mind-control-with-actionscript-3-0.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simplifying Box2DAS3&#8230;</title>
		<link>http://www.psyked.co.uk/actionscript/simplifying-box2das3.htm</link>
		<comments>http://www.psyked.co.uk/actionscript/simplifying-box2das3.htm#comments</comments>
		<pubDate>Fri, 08 Jan 2010 08:25:15 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Box2D]]></category>

		<guid isPermaLink="false">http://www.psyked.co.uk/?p=1089</guid>
		<description><![CDATA[One of the downsides to the Box2DAS3 project &#8211; and probably one of the major hurdles to most Flash developers &#8211; is the fact that it&#8217;s inherited a lot of the syntax from the C++ project that it&#8217;s derived from.  Maybe it&#8217;s just because we&#8217;re used to it, but Actionscript is pretty easy to understand, [...]]]></description>
			<content:encoded><![CDATA[<p>One of the downsides to the Box2DAS3 project &#8211; and probably one of the major hurdles to most Flash developers &#8211; is the fact that it&#8217;s inherited a lot of the syntax from the C++ project that it&#8217;s derived from.  Maybe it&#8217;s just because we&#8217;re used to it, but Actionscript is pretty easy to understand, and its methods of working pretty tolerant of inefficient coding.</p>
<p>C++ &#8211; or whatever Box2D is written in &#8211; is not, and it&#8217;s a little painful to setup and easy to break.  For my sanity as much as anyone else&#8217;s I&#8217;m working on a set of classes in AS3 that wrap around the Box2DAS3 classes, and provide you with a more familiar syntax for working with Box2D &#8211; objects, methods and utilities that makes it quicker to throw things together and don&#8217;t require you to rethink the way you work.</p>
<p>Well, that&#8217;s the eventual aim anyway.</p>
<p>Here&#8217;s the result of the first round of development &#8211; creating a Box2D world and adding objects, in about 6 lines of code.</p>
<pre class="brush: javascript">
var options:Box2DWorldOptions = new Box2DWorldOptions( 500, 280, 30, 9.8 );
options.setWorldEdges( true, true, true, true );
var world:Box2DWorld = Box2DUtils.createBoxedWorld( options );
world.debugDraw = true;
world.animateOnEnterFrame = true;
addChild( world );
for ( var i:int = 0; i &lt; 30; i++ )
{
world.createCircle( 500 * Math.random(), 280 * Math.random(), 50 * Math.random());
}
</pre>
<p>And here&#8217;s the result:</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Box2DExperiments_1700719812"
			class="flashmovie"
			width="500"
			height="280">
	<param name="movie" value="http://www.psyked.co.uk/wp-content/uploads/2010/01/Box2DExperiments.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.psyked.co.uk/wp-content/uploads/2010/01/Box2DExperiments.swf"
			name="fm_Box2DExperiments_1700719812"
			width="500"
			height="280">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p><span id="more-1089"></span>Not at the point of getting any interaction, or anything more interesting yet, but I&#8217;ve create a utility class for creating Box2D worlds and a Box2DWorld class (as opposed to b2World, which it extends).  The aim of these classes is to condense about 40 &#8211; 60 lines of initialisation and basic scenarios into just a few lines, using default variables whilst still allowing for optional overrides.  So if you wanted a world with 0 gravity, that&#8217;s just a case of changing it at the start.</p>
<p>I&#8217;ll post the classes soon &#8211; just as soon as I decide the best way to do so.  It&#8217;ll all become more clear then, I hope.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/actionscript/simplifying-box2das3.htm/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>The results of my annual &#8220;code something different this Christmas&#8221; idea.</title>
		<link>http://www.psyked.co.uk/actionscript/the-results-of-my-annual-code-something-different-this-christmas-idea.htm</link>
		<comments>http://www.psyked.co.uk/actionscript/the-results-of-my-annual-code-something-different-this-christmas-idea.htm#comments</comments>
		<pubDate>Mon, 04 Jan 2010 08:23:39 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Box2D]]></category>

		<guid isPermaLink="false">http://www.psyked.co.uk/?p=1085</guid>
		<description><![CDATA[It&#8217;s becoming something of a tradition now I guess, but once I&#8217;ve allocated that extra Christmas holiday time appropriately, I find I have that little bit of extra time to devote to trying something new.  This year, I thought I&#8217;d try rewriting (again) one of my old university experiments.
Here&#8217;s the result:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_AvatarGame_2140319442"
			class="flashmovie"
			width="500"
			height="280">
	<param name="movie" value="http://www.psyked.co.uk/wp-content/uploads/2010/01/AvatarGame.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.psyked.co.uk/wp-content/uploads/2010/01/AvatarGame.swf"
			name="fm_AvatarGame_2140319442"
			width="500"
			height="280">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
It&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s becoming something of a tradition now I guess, but once I&#8217;ve allocated that extra Christmas holiday time appropriately, I find I have that little bit of extra time to devote to trying something new.  This year, I thought I&#8217;d try rewriting (again) one of my old university experiments.</p>
<p>Here&#8217;s the result:</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_AvatarGame_464199217"
			class="flashmovie"
			width="500"
			height="280">
	<param name="movie" value="http://www.psyked.co.uk/wp-content/uploads/2010/01/AvatarGame.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.psyked.co.uk/wp-content/uploads/2010/01/AvatarGame.swf"
			name="fm_AvatarGame_464199217"
			width="500"
			height="280">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>It&#8217;s pretty.  I won&#8217;t even try to explain the idea behind it, but it&#8217;s basically an attempt at simple life simulation, with some AI governing the actions.  This time around I&#8217;ve built it with the aid of Box2D, so all the movement, impacts and interaction is achieved by punching some figures into the Box2D world, which makes the thing a helluva lot easier.</p>
<p>The big plus of &#8220;trying something new&#8221;? I now have a basic understanding of trigonometry!  I didn&#8217;t even have to Google anything!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/actionscript/the-results-of-my-annual-code-something-different-this-christmas-idea.htm/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Link: Name your loops</title>
		<link>http://www.psyked.co.uk/actionscript/link-name-your-loops.htm</link>
		<comments>http://www.psyked.co.uk/actionscript/link-name-your-loops.htm#comments</comments>
		<pubDate>Fri, 04 Dec 2009 08:05:25 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Exertnal Links]]></category>

		<guid isPermaLink="false">http://www.psyked.co.uk/?p=1047</guid>
		<description><![CDATA[
You can name your loops!  Okay, so it&#8217;s not very exciting, but naming your loops will make things so much easier to organise and understand &#8211; I expect.  Check out the link to read all about it;
http://blogs.adobe.com/cantrell/archives/2009/12/labels_in_actionscript_3.html
]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.adobe.com/cantrell/archives/2009/12/labels_in_actionscript_3.html" target="_blank"><img class="alignnone size-full wp-image-1048" title="Name your loops" src="http://www.psyked.co.uk/wp-content/uploads/2009/12/nameyourloops.jpg" alt="Name your loops" width="500" height="280" /></a></p>
<p>You can name your loops!  Okay, so it&#8217;s not very exciting, but naming your loops will make things so much easier to organise and understand &#8211; I expect.  Check out the link to read all about it;</p>
<p><a href="http://blogs.adobe.com/cantrell/archives/2009/12/labels_in_actionscript_3.html" target="_blank">http://blogs.adobe.com/cantrell/archives/2009/12/labels_in_actionscript_3.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/actionscript/link-name-your-loops.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cool ActionScript projects to try out, if you haven&#8217;t already&#8230;</title>
		<link>http://www.psyked.co.uk/actionscript/cool-actionscript-projects-to-try-out-if-you-havent-already.htm</link>
		<comments>http://www.psyked.co.uk/actionscript/cool-actionscript-projects-to-try-out-if-you-havent-already.htm#comments</comments>
		<pubDate>Thu, 05 Nov 2009 08:47:52 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Box2D]]></category>
		<category><![CDATA[Collision Detection Kit]]></category>
		<category><![CDATA[Timeline]]></category>
		<category><![CDATA[Tweening]]></category>

		<guid isPermaLink="false">http://www.psyked.co.uk/?p=1010</guid>
		<description><![CDATA[Hopefully I&#8217;ll get a chance to cover each of these in more detail shortly, but there&#8217;s a whole bunch of cool new Actionscript 3 projects that are floating around at the moment &#8211; here are some of my favourites that I&#8217;m trying to find enough time to explore in detail.  Each stands out from the [...]]]></description>
			<content:encoded><![CDATA[<p>Hopefully I&#8217;ll get a chance to cover each of these in more detail shortly, but there&#8217;s a whole bunch of cool new Actionscript 3 projects that are floating around at the moment &#8211; here are some of my favourites that I&#8217;m trying to find enough time to explore in detail.  Each stands out from the crowd for being pretty awesome, and I&#8217;m hoping to find some killer way to combine them into my projects.</p>
<h3>For Animations &amp; Tweening:</h3>
<p><strong>GreenSock Tweening Platform</strong> [<a href="http://blog.greensock.com/v11/" target="_blank">link</a>]<br />
The name actually encompasses five different varieties of animation libraries, and is awesome at scripting individual and timeline animations.  Not just that, but it comes packed with a load of animation options that you didn&#8217;t know you wanted, until you see them.  Like realistic motion blur.  That one&#8217;s cool.  Especially once you&#8217;ve tried making it yourself in the past&#8230;</p>
<p><a href="http://blog.greensock.com/v11/" target="_blank"><img class="alignnone size-full wp-image-1011" title="Clipboard data 04-11-09, 23-03-42" src="http://www.psyked.co.uk/wp-content/uploads/2009/11/Clipboard-data-04-11-09-23-03-42.jpg" alt="Clipboard data 04-11-09, 23-03-42" width="500" height="280" /></a></p>
<h3>Game development</h3>
<p><strong>Collision Detection Kit</strong> [<a href="http://coreyoneil.com/portfolio/index.php?project=5" target="_blank">link</a>]<br />
Much like the GreenSock stuff, just how good this is really has to be seen to be believed.  The basic Actionscript hit-test tools were never really that great.  Sure they worked, but if you wanted anything more than a Boolean response, it was no good at all.  The Collision Detection Kit gives you enough information to do proper physics &#8211; working out things like what, where and how hard things hit.  It works with any display object &#8211; vectors, bitmaps, even video.</p>
<p><a href="http://coreyoneil.com/portfolio/index.php?project=5" target="_blank"><img class="alignnone size-full wp-image-1014" title="Clipboard data 04-11-09, 23-05-18" src="http://www.psyked.co.uk/wp-content/uploads/2009/11/Clipboard-data-04-11-09-23-05-18.jpg" alt="Clipboard data 04-11-09, 23-05-18" width="500" height="280" /></a></p>
<p><strong>Box2D<span style="font-weight: normal;"> [<a href="http://box2dflash.sourceforge.net/" target="_blank">link</a>]</span><br />
<span style="font-weight: normal;">Box2D.  Runs blindingly fast, precisely calculates physics and interactions.  It&#8217;s a true physics engine, rather than others (like Collision Detection Kit) which are just imitating physics.  A little hard to get into because it&#8217;s all written differently to every other Actionscript example I&#8217;ve ever seen (&#8220;You must unlearn what you have learnt&#8221;) but once you get over that hurdle, it&#8217;s just so&#8230; powerful.</span></strong></p>
<p><a href="http://box2dflash.sourceforge.net/" target="_blank"><img class="alignnone size-full wp-image-1013" title="Clipboard data 04-11-09, 23-07-22" src="http://www.psyked.co.uk/wp-content/uploads/2009/11/Clipboard-data-04-11-09-23-07-22.jpg" alt="Clipboard data 04-11-09, 23-07-22" width="500" height="280" /></a></p>
<p>Documentation for Box2D isn&#8217;t very new user friendly, but Emanuele Feronato has a fantastic series of <a href="http://www.emanueleferonato.com/category/box2d/" target="_blank">blog posts on Box2D</a> which will prove invaluable.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/actionscript/cool-actionscript-projects-to-try-out-if-you-havent-already.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Link: Cool Actionscript 3 &#8216;Genie&#8217; effect</title>
		<link>http://www.psyked.co.uk/actionscript/link-cool-actionscript-3-genie-effect.htm</link>
		<comments>http://www.psyked.co.uk/actionscript/link-cool-actionscript-3-genie-effect.htm#comments</comments>
		<pubDate>Thu, 17 Sep 2009 08:22:19 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Pixel Bender]]></category>

		<guid isPermaLink="false">http://www.psyked.co.uk/?p=952</guid>
		<description><![CDATA[This is an awesome link that Mark sent around the other day &#8211; a cool Mac-esque &#8216;Genie&#8217; effect.

That effect is all very cool, but even more surprising is that it seems to be an Actionscripted effect, rather than a Pixel Bender effect.  You can find the blog post from the guy that created this here, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://fladdict.net/exp/ginnyeffect/" target="_blank">This</a> is an awesome link that <a href="http://markstar.co.uk/" target="_blank">Mark</a> sent around the other day &#8211; a cool Mac-esque &#8216;Genie&#8217; effect.</p>
<p><a href="http://fladdict.net/exp/ginnyeffect/" target="_blank"><img class="alignnone size-full wp-image-953" title="GenieEffect" src="http://www.psyked.co.uk/wp-content/uploads/2009/09/Clipboard-data-15-09-09-22-37-17.jpg" alt="GenieEffect" width="500" height="280" /></a></p>
<p>That effect is all very cool, but even more surprising is that it seems to be an Actionscripted effect, rather than a Pixel Bender effect.  You can find the blog post from the guy that created this <a href="http://blog.jactionscripters.com/2009/09/09/genie-effect-with-as3/" target="_blank">here</a>, and even better can find a live online example <a href="http://wonderfl.net/code/b8ec2e7155357ddc65d21eb8b1fa2e94c8363cfc" target="_blank">here</a>.</p>
<ul>
<li><a href="http://fladdict.net/exp/ginnyeffect/">http://fladdict.net/exp/ginnyeffect/</a></li>
<li><a href="http://blog.jactionscripters.com/2009/09/09/genie-effect-with-as3/">http://blog.jactionscripters.com/2009/09/09/genie-effect-with-as3/</a></li>
<li><a href="http://wonderfl.net/code/b8ec2e7155357ddc65d21eb8b1fa2e94c8363cfc">http://wonderfl.net/code/b8ec2e7155357ddc65d21eb8b1fa2e94c8363cfc</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/actionscript/link-cool-actionscript-3-genie-effect.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rotating BitmapData with Actionscript 3</title>
		<link>http://www.psyked.co.uk/actionscript/rotating-bitmapdata.htm</link>
		<comments>http://www.psyked.co.uk/actionscript/rotating-bitmapdata.htm#comments</comments>
		<pubDate>Tue, 15 Sep 2009 21:00:07 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[bitmapdata]]></category>
		<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://www.psyked.co.uk/?p=942</guid>
		<description><![CDATA[Here&#8217;s a little snippet &#8211; rotating BitmapData (through 90 degrees) with Actionscript 3.

var matrix:Matrix = new Matrix();
matrix.translate(-bmd.width / 2, -bmd.height / 2);
matrix.rotate(90 * (Math.PI / 180));
matrix.translate(bmd.height / 2, bmd.width / 2);
var matriximage:BitmapData = new BitmapData(bmd.height, bmd.width, false, 0x00000000);
matriximage.draw(bmd, matrix);

The code above can rotate an images BitmapData, using a Matrix to transform the image when you [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a little snippet &#8211; rotating BitmapData (through 90 degrees) with Actionscript 3.</p>
<pre class="brush: javascript">
var matrix:Matrix = new Matrix();
matrix.translate(-bmd.width / 2, -bmd.height / 2);
matrix.rotate(90 * (Math.PI / 180));
matrix.translate(bmd.height / 2, bmd.width / 2);
var matriximage:BitmapData = new BitmapData(bmd.height, bmd.width, false, 0x00000000);
matriximage.draw(bmd, matrix);
</pre>
<p>The code above can rotate an images BitmapData, using a Matrix to transform the image when you draw the data.  It&#8217;s only really designed to rotate the image in 90 degree increments though &#8211; so be aware of that.</p>
<p>How it actually works is to create a new Matrix object, offset the source BitmapData&#8217;s width and height (so the rotation goes from the center of the bitmap), rotate the BitmapData, move the BitmapData again (to undo the previous offset), create a new BitmapData object to draw the rotated BitmapData into, and finally draw the source BitmapData with our newly created Matrix.</p>
<p>Simple.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/actionscript/rotating-bitmapdata.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
