<?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></description>
	<lastBuildDate>Fri, 27 Jan 2012 15:02:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>I hate using AVM1Movie&#8230;</title>
		<link>http://www.psyked.co.uk/actionscript/i-hate-using-avm1movie.htm</link>
		<comments>http://www.psyked.co.uk/actionscript/i-hate-using-avm1movie.htm#comments</comments>
		<pubDate>Mon, 22 Nov 2010 23:20:19 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ActionScript]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Developer beware.  AVM1Movie content (running ActionScript 2 content inside ActionScript 3 movies) is a spiralling nexus of doom that will lead to your eventual insanity, if you persist in walking down that path. Seriously.  I&#8217;d love to catalogue the many intricacies and weird behaviours of AVM1Movie content, but that would mean being able to understand [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-1263" src="http://uploads.psyked.co.uk/2010/11/avm1movie-hydra.jpg" alt="" width="500" height="280" /></p>
<p>Developer beware.  AVM1Movie content (running ActionScript 2 content inside ActionScript 3 movies) is a spiralling nexus of doom that will lead to your eventual insanity, if you persist in walking down that path.</p>
<p><span id="more-1262"></span>Seriously.  I&#8217;d love to catalogue the many intricacies and weird behaviours of AVM1Movie content, but that would mean being able to understand and explain them &#8211; which I can&#8217;t do. The bottom line is that ActionScript 2 content in an ActionScript 3 movie doesn&#8217;t behave the same as an ActionScript 2 movie does on its own.  Certain things just flat-out don&#8217;t work, or don&#8217;t work &#8216;a certain way&#8217;.  Others that you thought did work actually work slightly or completely different, but do start working correctly with some encouragement.</p>
<h3>Want some examples?</h3>
<p>Goodness knows if they&#8217;re always repeatable, but these certainly happened to me&#8230;</p>
<ul>
<li>In AS2, draw a rectangle, with a width of 130 pixels.  Measure the width.  What is the width, according to Flash? 89 pixels.  Fan-tastic.  Cast the width as a Number (even though it was already a number) before you start drawing, and try again.  What is the width this time, according to Flash? 130 pixels.</li>
<li>Dynamically generate an XML structure in AS2, using the <strong>addElement </strong>or <strong>createElement </strong>methods.  It works in AS2 on its own, nothing works when it&#8217;s loaded as AVM1.  Rewrite the function to create everything as a String and call <strong>parseXML</strong> on it.  It all works.</li>
<li>Try calling a function.  Function doesn&#8217;t work.  Set an enterFrame listener, and call the function a single frame later.  It works.</li>
</ul>
<p>AVM1Movie has done its utmost to ruin my sanity &#8211; don&#8217;t let it ruin yours.<br />
Avoid doing anything technically complicated in it, rewrite it all in AS3 if you can!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/actionscript/i-hate-using-avm1movie.htm/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>StarRequests, Simple-Box2D &amp; Flickr &#8211; a example mashup.</title>
		<link>http://www.psyked.co.uk/actionscript/starrequests-simple-box2d-flickr-mashup-sample.htm</link>
		<comments>http://www.psyked.co.uk/actionscript/starrequests-simple-box2d-flickr-mashup-sample.htm#comments</comments>
		<pubDate>Mon, 07 Jun 2010 23:44:30 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flickr]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Simple-Box2D]]></category>
		<category><![CDATA[StarRequests]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Mark (of MarkStar.co.uk) has been working away on his pet project &#8220;StarRequests&#8220; for a little while now, so I thought I&#8217;d give it a whirl and see what he&#8217;s come up with &#8211; and of course, what I could come up with off the back of it.  This is the result; a Flickr image loader, with a [...]]]></description>
			<content:encoded><![CDATA[<p>Mark (of <a href="http://markstar.co.uk" target="_blank">MarkStar.co.uk</a>) has been working away on his pet project &#8220;<a href="http://markstar.co.uk/blog/category/starrequests/" target="_blank">StarRequests</a>&#8220; for a little while now, so I thought I&#8217;d give it a whirl and see what he&#8217;s come up with &#8211; and of course, what I could come up with off the back of it.  This is the result; a Flickr image loader, with a smidge of Box2D mixed in to make it all seem more interesting.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Main_225686056"
			class="flashmovie"
			width="500"
			height="560">
	<param name="movie" value="http://uploads.psyked.co.uk/2010/06/Main.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://uploads.psyked.co.uk/2010/06/Main.swf"
			name="fm_Main_225686056"
			width="500"
			height="560">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p><span id="more-1229"></span>All of the code for this demo, along with a few others, are available from <a href="http://github.com/psyked/StarRequests-Examples" target="_blank">GitHub</a>, and for those unfamiliar with GitHub, <a href="http://github.com/psyked/StarRequests-Examples/zipball/master" target="_blank">here&#8217;s the Zip archive</a>. While we&#8217;ve some time, let&#8217;s run through some key elements of this sample:</p>
<h2>The demo:</h2>
<p>If you can&#8217;t see the demo, for whatever reason, I&#8217;ve stuck an image of it below this paragraph.  There&#8217;s a search term box, a numeric stepper for the number of images, and a search button.  When you click &#8216;Get images&#8217; it performs a search on the Flickr API, which returns a list of images.  I&#8217;m then using the StarRequests library to sequentially load the images from Flickr, and throwing them into Simple-Box2D to display them in a funky interactive way.</p>
<p><img class="alignnone size-full wp-image-1232" title="Demo (JPEG)" src="http://uploads.psyked.co.uk/2010/06/starrequest-example.jpg" alt="" width="500" height="560" /></p>
<h3>StarRequests</h3>
<p>It&#8217;s probably more of a micro-framework at the moment, but StarRequests is designed to make it easy to perform a series of actions (requests) that can be queued or batch-executed in a way that&#8217;s portable between projects.  It&#8217;s designed to deal with common tasks, like loading a remote URL and extracting the BitmapData, while also abstracting their inputs and outputs to make it possible to mix request types in a single queue.  And queueing is important a lot of the time, because trying to do everything simultaneously often ends with snarl-ups and complex queue management.  With a properly constructed StarRequest class, the systems you so often write and rewrite for different projects are much more portable.</p>
<p>For this example I had to write a complete StarRequest class to load images from Flickr &#8211; and that&#8217;s all it does &#8211; but on the plus side I didn&#8217;t have to touch the queuing system, I now have a reusable Flickr image loader class that I can use again in the future, and I also know that elements, like the queuing system, are a solid base to work from.  There&#8217;s more tasks going on in this example that I could extract into StarRequests format, but that&#8217;s a task for another day.</p>
<h3>Simple-Box2D</h3>
<p>A little side-project of mine, <a href="http://www.psyked.co.uk/category/box2d" target="_blank">Simple-Box2D</a> is a set of classes that ease the learning curve between ActionScript and Box2D style code.  It&#8217;s in dire need of some new functions, cleanup and most of all, code commenting.  Sorry about that.  All this is doing is taking the final Bitmap objects returned from the StarRequest classes, and using their dimensions as the basis for new objects in the Box2D world.</p>
<h3>Flickr</h3>
<p>I&#8217;m making use of the excellent <a href="http://code.google.com/p/as3flickrlib/" target="_blank">as3flickrlib</a> classes to interact with Flickr, and then adding a bit of url stitching in the StarRequest classes to create the references to the actual image files (because the API doesn&#8217;t return that data).</p>
<p>&#8230; that&#8217;s all folks.  Comments appreciated &#8211; I know this isn&#8217;t much of a tutorial, I shall have to conspire with Mark and see if we can get one created.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/actionscript/starrequests-simple-box2d-flickr-mashup-sample.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Link: Value Object Class generator for ActionScript 3</title>
		<link>http://www.psyked.co.uk/actionscript/link-value-object-class-generator-for-as3.htm</link>
		<comments>http://www.psyked.co.uk/actionscript/link-value-object-class-generator-for-as3.htm#comments</comments>
		<pubDate>Fri, 26 Mar 2010 09:08:42 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[External links]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[A bit specialist perhaps, and the need for such a tool might become redundant if the Flash Builder hype is to be believed, but I found this quite useful for speeding up the process of writing a value-object class in AS3. http://projects.stroep.nl/ValueObjectGenerator/ What is a value object anyway? For the uninitiated, a value object class [...]]]></description>
			<content:encoded><![CDATA[<p>A bit specialist perhaps, and the need for such a tool might become redundant if the Flash Builder hype is to be believed, but I found this quite useful for speeding up the process of writing a value-object class in AS3.</p>
<p><a href="http://projects.stroep.nl/ValueObjectGenerator/">http://projects.stroep.nl/ValueObjectGenerator/</a></p>
<h3>What is a value object anyway?</h3>
<p>For the uninitiated, a value object class is essentially a class with very little or no application logic inside it.</p>
<p>Instead of being a file that actually does something, it&#8217;s more of a class for just storing data.  What makes it special is that AS3 classes are not all dynamic, so you have to plan what data you need to store and how you&#8217;ll store it; and you can achieve a vast majority of that with value object classes.</p>
<p>If you&#8217;re coming from an AS2 or Flash IDE background you might think it&#8217;s a bit unnecessary or even frustrating, but when you plug value object classes into a development environment like Flex Builder you see where it comes in useful, when it can actually gives you useful autocomplete suggestions, and warns you if you&#8217;re passing the wrong type of data into your classes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/actionscript/link-value-object-class-generator-for-as3.htm/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<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"></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://uploads.psyked.co.uk/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://OneofthedownsidestotheBox2DAS3project-andprobablyoneofthemajorhurdlestomostFlashdevelopers-isthefactthatit&#039;sinheritedalotofthesyntaxfromtheC++projectthatit&#039;sderivedfrom. Maybeit&#039;sjustbecausewe&#039;reusedtoit,bu</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_347193787"
			class="flashmovie"
			width="500"
			height="280">
	<param name="movie" value="http://uploads.psyked.co.uk/2010/01/Box2DExperiments.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://uploads.psyked.co.uk/2010/01/Box2DExperiments.swf"
			name="fm_Box2DExperiments_347193787"
			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>10</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced
Database Caching 1/27 queries in 0.038 seconds using disk: basic
Object Caching 757/798 objects using disk: basic

Served from: www.psyked.co.uk @ 2012-02-04 04:54:19 -->
