<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Swingpant&#039;s Game Lab &#187; Code Snippet</title>
	<atom:link href="http://swingpants.com/category/code-snippet/feed/" rel="self" type="application/rss+xml" />
	<link>http://swingpants.com</link>
	<description>Swingpant&#039;s Code Nurdlings</description>
	<lastBuildDate>Wed, 08 Feb 2012 08:02:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='swingpants.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/4a88693aa17d6b5e1d453a6684bc1c68?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Swingpant&#039;s Game Lab &#187; Code Snippet</title>
		<link>http://swingpants.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://swingpants.com/osd.xml" title="Swingpant&#039;s Game Lab" />
	<atom:link rel='hub' href='http://swingpants.com/?pushpress=hub'/>
		<item>
		<title>HTML5 Game Dev. DOM Manipulation. It&#8217;s costly, so minimise its use.</title>
		<link>http://swingpants.com/2012/02/08/html5-game-dev-dom-manipulation-its-costly-so-minimise-its-use/</link>
		<comments>http://swingpants.com/2012/02/08/html5-game-dev-dom-manipulation-its-costly-so-minimise-its-use/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 00:22:45 +0000</pubDate>
		<dc:creator>swingpants</dc:creator>
				<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[jsperf]]></category>
		<category><![CDATA[Optimisation]]></category>

		<guid isPermaLink="false">http://swingpants.com/?p=450</guid>
		<description><![CDATA[Typically when manipulating display objects in Flash, applying positional data is a trivial task so you wouldn&#8217;t think twice about applying the data on every game loop. It doesn&#8217;t matter that the object hasn&#8217;t moved on that frame. The overhead would be minimal, you can just reapply without penalty &#8211; in fact to engage with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=450&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Typically when manipulating display objects in Flash, applying positional data is a trivial task so you wouldn&#8217;t think twice about applying the data on every game loop. It doesn&#8217;t matter that the object hasn&#8217;t moved on that frame. The overhead would be minimal, you can just reapply without penalty &#8211; in fact to engage with any conditional to test for the need to apply could be more costly in the long run.</p>
<p>With DOM manipulation, any update seems to be fairly processor expensive. Very non-trivial. Here it is essential that updates should be applied ONLY when absolutely necessary.</p>
<p>I ran a test script at <a href="http://jsperf.com/optimising-dom-access" title="JSPerf.com">JSPerf.com</a> which demonstrated the issue. I set up a Div with some simple text content. Then manipulate it on every iteration. I move the x-position by 0.2, then round off the position before applying. To optimise I only apply the dom manipulation when the actual object has changed position. The results are stark. A massive performance boost. </p>
<div id="attachment_453" class="wp-caption aligncenter" style="width: 610px"><a href="http://jsperf.com/optimising-dom-access"><img src="http://flashlabs.files.wordpress.com/2012/02/dommanipulationoptimisation.jpg?w=655" alt="" title="Dom Manipulation Optimisation"   class="size-full wp-image-453" /></a><p class="wp-caption-text">Optimise your DOM manipulations. It pays.</p></div>
<p>The code used is simple, and as follows. Create a div, populate then manipulate:</p>
<blockquote><p>
<strong></p>
<p>    var targetDIV = document.createElement(&#8220;div&#8221;);<br />
    targetDIV.innerHTML = &#8220;test data&#8221;;<br />
    document.doby.appendChild(targetDIV);<br />
    var posX =0, prevPosX=0;</p>
<p>    function unoptimisedManipulation()<br />
      {<br />
        posX+=0.2;<br />
        var roundX = Math.round(posX);</p>
<p>        if(posX&gt;500) {posX=0;}<br />
        targetDIV.style.left=roundX+&#8221;px&#8221;;</p>
<p>        prevPosX = roundX;<br />
      }</p>
<p>    function optimisedManipulation()<br />
      {<br />
        posX+=0.2;<br />
        var roundX = Math.round(posX);<br />
        if(prevPosX!=roundX)<br />
          {<br />
            if(posX&gt;500) {posX=0;}<br />
            targetDIV.style.left=roundX+&#8221;px&#8221;;</p>
<p>            prevPosX = roundX;<br />
          }<br />
      }</p>
<p></strong>
</p></blockquote>
<p>The results aren&#8217;t indicating that DOM manipulation should be avoided &#8211; Android devices really struggle with Canvas so DOM is preferable &#8211; it just takes a bit of effort to make the DOM production ready.</p>
<p>Try running the tests yourself at JSPerf.com : <a href="http://jsperf.com/optimising-dom-access" title="http://jsperf.com/optimising-dom-access"><strong>http://jsperf.com/optimising-dom-access</strong></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flashlabs.wordpress.com/450/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flashlabs.wordpress.com/450/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flashlabs.wordpress.com/450/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flashlabs.wordpress.com/450/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flashlabs.wordpress.com/450/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flashlabs.wordpress.com/450/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flashlabs.wordpress.com/450/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flashlabs.wordpress.com/450/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flashlabs.wordpress.com/450/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flashlabs.wordpress.com/450/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flashlabs.wordpress.com/450/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flashlabs.wordpress.com/450/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flashlabs.wordpress.com/450/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flashlabs.wordpress.com/450/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=450&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://swingpants.com/2012/02/08/html5-game-dev-dom-manipulation-its-costly-so-minimise-its-use/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1cebf29489913586137c5bdad0414c88?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">swingpants</media:title>
		</media:content>

		<media:content url="http://flashlabs.files.wordpress.com/2012/02/dommanipulationoptimisation.jpg" medium="image">
			<media:title type="html">Dom Manipulation Optimisation</media:title>
		</media:content>
	</item>
		<item>
		<title>HTML5 Flipping a DIV &#8211; Horizontally Inverting content with Javascript and CSS</title>
		<link>http://swingpants.com/2012/02/07/html5-flipping-a-div-horizontally-inverting-an-image/</link>
		<comments>http://swingpants.com/2012/02/07/html5-flipping-a-div-horizontally-inverting-an-image/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 22:21:23 +0000</pubDate>
		<dc:creator>swingpants</dc:creator>
				<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Conference]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[css transform]]></category>
		<category><![CDATA[spritesheet]]></category>

		<guid isPermaLink="false">http://swingpants.com/?p=436</guid>
		<description><![CDATA[As I prepare for my talk at FITC Amsterdam (Feb 2012) I&#8217;m building a web game in both Flash &#38; HTML5. I&#8217;m aiming my HTML5 build at the mobile web (but will try to reach as many desktop browsers as possible) &#8211; so it will need to run optimally across Android &#38; iOS. I&#8217;ve discovered [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=436&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As I prepare for my talk at FITC Amsterdam (Feb 2012) I&#8217;m building a web game in both Flash &amp; HTML5. </p>
<p>I&#8217;m aiming my HTML5 build at the mobile web (but will try to reach as many desktop browsers as possible) &#8211; so it will need to run optimally across Android &amp; iOS.</p>
<p>I&#8217;ve discovered a few issues so far that for the purpose of record and reference I&#8217;ll post here in game lab.</p>
<p><strong>First up.</strong> I have a player character that I&#8217;m animating via a spritesheet. I need the character to be able to face left and right. </p>
<p>I made the assumption that I could drop the sheet into a div (as background image) and then apply a scaleX  transition to the div when I need to face left, and remove the transition when I need to turn right.</p>
<p>I&#8217;m applying the horizontal flip by adding a CSS classname to the div.</p>
<p><strong>The CSS:</strong></p>
<blockquote><p>
               <strong>.flip-horizontal<br />
			{<br />
				-moz-transform: scaleX(-1);<br />
				-webkit-transform: scaleX(-1);<br />
				-o-transform: scaleX(-1);<br />
				transform: scaleX(-1);<br />
				filter: FlipH; /*for IE*/<br />
				-ms-filter: &#8220;FlipH&#8221;;<br />
			}</strong>
</p></blockquote>
<p>Then when I need my character to face left I add the class name to the character div:</p>
<blockquote><p>
<strong>function faceLeft() {characterDIV.className = &#8220;flip-horizontal&#8221;;}<br />
function faceRight() {characterDIV.className = &#8220;&#8221;;}</strong>
</p></blockquote>
<p>So, is this good? Works fantastically on the desktop browsers and really well on Android. </p>
<p><strong>BUT</strong>, on iOS (iPad in my tests) there is a <strong>BIG</strong> lag when the webkit transform is applied.</p>
<p>I mean big &#8211; in my game there can be up to a second long hang. Totally unacceptable for any game usage (unless as a one shot on initialisation).</p>
<p><strong>The answer?</strong> Unfortunately I couldn&#8217;t come up with a technical solution. I had to resort to putting the reverse animation on the spritesheet. This gives me the performance I want &#8211; but at the expense of more weight to the game. </p>
<p>If my game has many characters then I am essentially doubling my asset weight for those characters. Boo.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flashlabs.wordpress.com/436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flashlabs.wordpress.com/436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flashlabs.wordpress.com/436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flashlabs.wordpress.com/436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flashlabs.wordpress.com/436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flashlabs.wordpress.com/436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flashlabs.wordpress.com/436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flashlabs.wordpress.com/436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flashlabs.wordpress.com/436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flashlabs.wordpress.com/436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flashlabs.wordpress.com/436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flashlabs.wordpress.com/436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flashlabs.wordpress.com/436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flashlabs.wordpress.com/436/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=436&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://swingpants.com/2012/02/07/html5-flipping-a-div-horizontally-inverting-an-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1cebf29489913586137c5bdad0414c88?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">swingpants</media:title>
		</media:content>
	</item>
		<item>
		<title>Introduction to Mercator Projections, Latitude and Longitude</title>
		<link>http://swingpants.com/2011/03/05/introduction-to-mercator-projections-latitude-and-longitude/</link>
		<comments>http://swingpants.com/2011/03/05/introduction-to-mercator-projections-latitude-and-longitude/#comments</comments>
		<pubDate>Sat, 05 Mar 2011 00:05:02 +0000</pubDate>
		<dc:creator>swingpants</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[3d coodinates]]></category>
		<category><![CDATA[latitude]]></category>
		<category><![CDATA[longitude]]></category>
		<category><![CDATA[Mercator Projection]]></category>

		<guid isPermaLink="false">http://swingpants.com/?p=360</guid>
		<description><![CDATA[Or how to place a map coordinate into 3D space. This post is a brief walk through of the basics from my 2010 presentation &#8220;Where in the world? Intercontinental Ballistic Flash&#8221;. Belgian, Flemish geographer and cartographer Gerardus Mercator, in 1569 presented a cylindrical map projection. The Mercator Projection quickly became the standard map used for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=360&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Or how to place a map coordinate into 3D space. This post is a brief walk through of the basics from my 2010 presentation &#8220;Where in the world? Intercontinental Ballistic Flash&#8221;.</p>
<p>Belgian, Flemish geographer and cartographer Gerardus Mercator, in 1569 presented a cylindrical map projection. The Mercator Projection quickly became the standard map used for nautical purposes. It&#8217;s advantages were that the scale is linear in any direction around a point, meaning all angles were preserved (conformal).</p>
<div id="attachment_361" class="wp-caption aligncenter" style="width: 308px"><a href="http://flashlabs.files.wordpress.com/2011/03/mercator_himself.jpg"><img src="http://flashlabs.files.wordpress.com/2011/03/mercator_himself.jpg?w=655" alt="Geographer and cartographer Gerardus Mercator" title="Gerardus Mercator"   class="size-full wp-image-361" /></a><p class="wp-caption-text">Gerardus Mercator</p></div>
<p>Around the equator feature shapes are accurately portrayed but as the poles are approached there is a size and shape distortion. The scale increases as the pole is neared, eventually becoming infinite when the pole is reached.</p>
<p>If you imagine the world as a beach ball. The Mercator Projection is the equivalent of cutting open the ball at each pole and stretching the skin to form a cylinder. Now slice down the cylinder and you have the map.</p>
<div id="attachment_363" class="wp-caption aligncenter" style="width: 510px"><a href="http://flashlabs.files.wordpress.com/2011/03/mercator_map_500.jpg"><img src="http://flashlabs.files.wordpress.com/2011/03/mercator_map_500.jpg?w=655" alt="" title="Mercator Map"   class="size-full wp-image-363" /></a><p class="wp-caption-text">The first Mercator projected map. 1569.</p></div>
<p>All map projections distort the shape or size of the Earth&#8217;s (or for that matter any other planet&#8217;s) surface. The Mercator Projection exaggerates areas far from the equator. Greenland seems as large as Africa, but is in fact 1/14 of the size, Antartica appears to be the largest continent but is in fact only 5th in terms of area.</p>
<p>Despite the obvious distortions, the Mercator Projection makes a great interactive map. Thanks to the conformality it can be zoomed nearly seamlessly.</p>
<p>So here we have a system that converts a 3D scene, the real world, onto a 2D plane, the map. This system can just as easily convert the 2D back to 3D. It is a coordinate system that requires two positional parameters and one constant: the planet radius.</p>
<p>The positional parameters are latitude and longitude. As developers we are used to standard coordinates x and y. Across then up. Horizontal then vertical. With latitude and longitude we have to think differently. Latitude is vertical and longitude is across. Up then across. Latitudes run from pole to pole, while longitudes run around the planet.</p>
<p>There are 180 degrees of latitude from the South Pole to the North pole, and 360 degrees around the planet. Imagine yourself sat at the centre of the Earth with a laser pointer. Point at the Equator then you are at 0 degrees latitude, at the South Pole -90 degrees and at the North Pole 90 degrees. Now point at the Equator again you can turn 180 degrees around the equator to the right (-180 degrees longitude) and to the left (180 degrees longitude).</p>
<p>With these any point on the surface of the planet can be recorded or indeed any position on a map.</p>
<p>So we have a system for calculating a position on the surface of a sphere, a 3D coordinate, but how do we convert latitude, longitude and the planet&#8217;s radius into a 3D x,y,z coordinate?</p>
<p><code></p>
<blockquote><p>
public static function convertLatLonTo3DPos(lat:Number, lon:Number, radius:Number):Vector3D<br />
	{<br />
		var v3d:Vector3D = new Vector3D();</p>
<p>		//Convert Lat Lon Degrees to Radians<br />
		var latRadians:Number = lat * TO_RADIANS;<br />
		var lonRadians:Number = lon * TO_RADIANS;</p>
<p>		v3d.x = radius * Math.cos(lonRadians) * Math.sin(latRadians);<br />
		v3d.z = radius * Math.sin(lonRadians) * Math.sin(latRadians);<br />
		v3d.y = -radius * Math.cos(latRadians);</p>
<p>		return v3d<br />
	}
</p></blockquote>
<p></code></p>
<p>Here the latitude and longitude are converted into radians ( TO_RADIANS:Number = Math.PI / 180 ). Then the trigonomic functions are applied to the planet radius to return a vector3D x,y and z.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flashlabs.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flashlabs.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flashlabs.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flashlabs.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flashlabs.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flashlabs.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flashlabs.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flashlabs.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flashlabs.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flashlabs.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flashlabs.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flashlabs.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flashlabs.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flashlabs.wordpress.com/360/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=360&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://swingpants.com/2011/03/05/introduction-to-mercator-projections-latitude-and-longitude/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1cebf29489913586137c5bdad0414c88?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">swingpants</media:title>
		</media:content>

		<media:content url="http://flashlabs.files.wordpress.com/2011/03/mercator_himself.jpg" medium="image">
			<media:title type="html">Gerardus Mercator</media:title>
		</media:content>

		<media:content url="http://flashlabs.files.wordpress.com/2011/03/mercator_map_500.jpg" medium="image">
			<media:title type="html">Mercator Map</media:title>
		</media:content>
	</item>
		<item>
		<title>AS3 Magnifying Glass Class :: Pixelbender Lense Refraction</title>
		<link>http://swingpants.com/2010/03/02/as3-magnifying-glass-class-pixelbender-lense-refraction/</link>
		<comments>http://swingpants.com/2010/03/02/as3-magnifying-glass-class-pixelbender-lense-refraction/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 01:54:57 +0000</pubDate>
		<dc:creator>swingpants</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[bitmapdata]]></category>
		<category><![CDATA[Effect]]></category>
		<category><![CDATA[lense]]></category>
		<category><![CDATA[Magnifying Glass]]></category>
		<category><![CDATA[Pixel Bender]]></category>
		<category><![CDATA[PixelBender]]></category>
		<category><![CDATA[Spherizer]]></category>
		<category><![CDATA[Spy Glass]]></category>
		<category><![CDATA[SpyGlass]]></category>

		<guid isPermaLink="false">http://swingpants.com/?p=253</guid>
		<description><![CDATA[The AS3 Magnifying Glass is a lense refraction class employing PixelBender. The class is an encapsulated method that takes a source image, a position and radius and returns a refracted result in sprite form. I needed to represent a spy glass in my current project, and was looking for a very efficient method to achieve [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=253&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The AS3 Magnifying Glass is a lense refraction class employing PixelBender. The class is an encapsulated method that takes a source image, a position and radius and returns a refracted result in sprite form.</p>
<p>I needed to represent a spy glass in my current project, and was looking for a very efficient method to achieve this. PixelBender seemed the obvious route and I&#8217;m pretty impressed by the speeds I am getting. I have max-ed out the frame rate and am still getting full (120) fps. </p>
<p>The MagnifyingGlass effect is the resultant class. The class embeds a pixelbender filter that spherizes it&#8217;s input and returns this as a sprite.</p>
<p>When using the class, the source image should be sent to the MagnifyingGlass full size, and be displayed to the user at a reduced size. This helps to preserve the integrity of the refracted image. </p>
<p>Usage:</p>
<blockquote><p>
<strong><br />
//refraction: 0=Lots, 1 =None<br />
//radius: The radius of the magnifying glass<br />
//position_point: The position of the magnifying glass on the source image<br />
//source_pic: BitmapData of the source picture<br />
magnifying_glass = new MagnifyingGlass(refraction,radius, posn_point, source_pic)</p>
<p>magnifying_glass.magnifyingGlassPosition=posn_point<br />
magnifying_glass.update()<br />
</strong>
</p></blockquote>
<div id="attachment_255" class="wp-caption aligncenter" style="width: 460px"><a href="http://www.swingpantsflash.com/magnifying_glass/"><img src="http://flashlabs.files.wordpress.com/2010/03/blog_pic.jpg?w=655" alt="AS3 Magnifying Glass Class" title="AS3 Magnifying Glass"   class="size-full wp-image-255" /></a><p class="wp-caption-text">The AS3 MagnifyingGlass Class</p></div>
<p>I have set up a quick demo that shows the class at work on 3 different images. Press any key to change the image.</p>
<p>Image#1: Have a look around a bit of England &amp; Wales. Enjoy.<br />
Image#2: Hundreds of cartoon characters. See if you can find Quagmire!  &#8211; Gigity.<br />
Image#3: There is a sheep in there somewhere.</p>
<p>NOTE: The PixelBender filter used here is based on Joa Ebert&#8217;s <a href="http://blog.joa-ebert.com/2007/10/02/more-on-hydra/">Spherize Filter</a> originally built in Hydra &#8211; the forerunner of PixelBender.</p>
<p>NOTE: This requires Flash Player 10 and above.</p>
<p>Demo: <a href="http://www.swingpantsflash.com/magnifying_glass/">Magnifying Glass Class Demo</a><br />
Source: <a href="http://www.swingpantsflash.com/magnifying_glass/MagnifyingGlass.zip">MagnifyingGlass.zip</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flashlabs.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flashlabs.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flashlabs.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flashlabs.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flashlabs.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flashlabs.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flashlabs.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flashlabs.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flashlabs.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flashlabs.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flashlabs.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flashlabs.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flashlabs.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flashlabs.wordpress.com/253/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=253&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://swingpants.com/2010/03/02/as3-magnifying-glass-class-pixelbender-lense-refraction/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1cebf29489913586137c5bdad0414c88?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">swingpants</media:title>
		</media:content>

		<media:content url="http://flashlabs.files.wordpress.com/2010/03/blog_pic.jpg" medium="image">
			<media:title type="html">AS3 Magnifying Glass</media:title>
		</media:content>
	</item>
		<item>
		<title>AS3 Flamer Class :: Setting things on fire</title>
		<link>http://swingpants.com/2010/02/25/as3-flamer-class-setting-things-on-fire/</link>
		<comments>http://swingpants.com/2010/02/25/as3-flamer-class-setting-things-on-fire/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 12:14:49 +0000</pubDate>
		<dc:creator>swingpants</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Effect]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Games]]></category>
		<category><![CDATA[bitmapdata]]></category>
		<category><![CDATA[blendMode]]></category>
		<category><![CDATA[convolution filter]]></category>
		<category><![CDATA[fire]]></category>
		<category><![CDATA[fire effect]]></category>
		<category><![CDATA[flamer]]></category>
		<category><![CDATA[flames]]></category>
		<category><![CDATA[paletteMap]]></category>
		<category><![CDATA[perlin noise]]></category>

		<guid isPermaLink="false">http://swingpants.com/?p=230</guid>
		<description><![CDATA[The Flamer Class is a quick and easy method to set things on fire. Throw some fuel (any display object) at the class and make it burn. While working on another project I needed to make some lightweight flames. I looked around, tried a bit of perlin noise, some convolution filters &#8211; then some PixelBender [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=230&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>
The Flamer Class is a quick and easy method to set things on fire. Throw some fuel (any display object) at the class and make it burn.
</p>
<p>
While working on another project I needed to make some lightweight flames. I looked around, tried a bit of perlin noise, some convolution filters &#8211; then some PixelBender filtering &#8211; I wasn&#8217;t really happy with the results.
</p>
<p>
I found the excellent Saqoosha&#8217;s <a href="http://wonderfl.net/code/bffb3437de866ffdfcdd5015b1fba5ca37fff72a">Fire</a> on <a href="http://wonderfl.net">Wonderfl</a>.<br />
This demo had nearly the flicker and colour mapping that I was looking for. Rendering the perlin noise on each frame was causing a bit too much processor overhead for my purposes.<br />
Instead of rendering two perlin octaves and moving the layers against each other, I took two separate single octave perlin noise bitmaps and rotated one against the other while blending.<br />
This gives a nice effect and is very lightweight. With the Saqoosha method I was clocking at a steady 26fps, with my lightweight method I could get 90fps.
</p>
<p>
To get the flame hues I set up a gradient box, threw some colours at it, loaded those colours into an array which I then pushed to a palette map.
</p>
<p>
So how to use the Flamer class:</p>
<blockquote><p>
<strong><br />
import swingpants.effect.Flamer</p>
<p>var flamer:Flamer=new Flamer(display_object)<br />
addChild(flamer)</p>
<p>addEventListener(Event.ENTER_FRAME, enterFrameHandler)<br />
function enterFrameHandler(event:Event):void<br />
   {<br />
     flamer.update()<br />
   }<br />
</strong>
</p></blockquote>
<p>Your object will now be on fire. Feel naughty?
</p>
<p>You can set the render width and height and also set the direction of the flames by setting a point vector.</p>
<blockquote><p>
<strong><br />
var flamer:Flamer=new Flamer(display_object,render_width, render_height, flame_direction_point)<br />
addChild(flamer)</p>
<p>//The colour of the flames can be set with one of the presets (There are 4 at the moment &#8211; ORANGE_FLAME, BLUE_FLAME, YELLOW_FLAME, GREEN_FLAME &#8211; but I will be adding more)<br />
flamer.setFlameColour(Flamer.BLUE_FLAME) </p>
<p>//Direction can be set on the fly:<br />
flamer.setFlameDirection(direction_point)<br />
</strong>
</p></blockquote>
<p>Here is a demo of a pure code use of the Flamer: <a href="http://www.swingpantsflash.com/flamer/Flamer.html">The Flaming Vortex</a>. You can click on the flash to initiate an explosion, and pressing space will change the colour. Have a play:</p>
<div id="attachment_232" class="wp-caption aligncenter" style="width: 360px"><a href="http://www.swingpantsflash.com/flamer/Flamer.html"><img src="http://flashlabs.files.wordpress.com/2010/02/flaming_sun.jpg?w=655" alt="Flaming Sun" title="flaming_sun"   class="size-full wp-image-232" /></a><p class="wp-caption-text">Flamer Class. The flaming vortex demo</p></div>
<p>This next demo is an example of throwing a movieclip/sprite at the Flamer class. Don&#8217;t laugh, I quite literally spent 10 minutes putting the anims together then threw them at the Flamer. Click on Flash to change colour and object.<br />
<div id="attachment_233" class="wp-caption aligncenter" style="width: 360px"><a href="http://www.swingpantsflash.com/flamer/FlaTestFlamer.html"><img src="http://flashlabs.files.wordpress.com/2010/02/flaming_car.jpg?w=655" alt="Flaming Car" title="flaming_car"   class="size-full wp-image-233" /></a><p class="wp-caption-text">Flamer Class Demo. Help, my car is on fire</p></div></p>
<p>Lots of fun can be had by throwing different animations at the Flamer. Control some with your mouse/keys. Become a twisted fire starter.</p>
<p>The Flamer class could do with a few more features, but is a pretty good start. The speed is pretty good, I&#8217;m happy to receive any improvement recommendations.</p>
<p>I have packed the Flamer class and demos up in a zip if you want to have a play:<br />
DOWNLOAD: <a href="http://www.swingpantsflash.com/flamer/FlamerClass.zip">Flamer Class and Demos</a></p>
<p>DEMO #1: <a href="http://www.swingpantsflash.com/flamer/Flamer.html">Flaming Vortex</a><br />
DEMO #2: <a href="http://www.swingpantsflash.com/flamer/FlaTestFlamer.html">Burning Movieclips</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flashlabs.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flashlabs.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flashlabs.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flashlabs.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flashlabs.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flashlabs.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flashlabs.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flashlabs.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flashlabs.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flashlabs.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flashlabs.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flashlabs.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flashlabs.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flashlabs.wordpress.com/230/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=230&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://swingpants.com/2010/02/25/as3-flamer-class-setting-things-on-fire/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1cebf29489913586137c5bdad0414c88?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">swingpants</media:title>
		</media:content>

		<media:content url="http://flashlabs.files.wordpress.com/2010/02/flaming_sun.jpg" medium="image">
			<media:title type="html">flaming_sun</media:title>
		</media:content>

		<media:content url="http://flashlabs.files.wordpress.com/2010/02/flaming_car.jpg" medium="image">
			<media:title type="html">flaming_car</media:title>
		</media:content>
	</item>
		<item>
		<title>Away3DLite: Translating 3D Coordinates to 2D Screen Position</title>
		<link>http://swingpants.com/2010/01/15/away3dlite-translating-3d-coordinates-to-2d-screen-position/</link>
		<comments>http://swingpants.com/2010/01/15/away3dlite-translating-3d-coordinates-to-2d-screen-position/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 00:10:27 +0000</pubDate>
		<dc:creator>swingpants</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[3D Coordinates]]></category>
		<category><![CDATA[3DSMax]]></category>
		<category><![CDATA[away3d]]></category>
		<category><![CDATA[Away3DLite]]></category>
		<category><![CDATA[MD2]]></category>

		<guid isPermaLink="false">http://swingpants.com/?p=215</guid>
		<description><![CDATA[I have been playing with the awesome Away3DLite. Playing with 1000s of polygons is very liberating, but still doesn&#8217;t mean we can slack off with the optimisation. It is important to take any opportunity to lessen the number of calculations performed per frame by the player. To this end, I was just putting together a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=215&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have been playing with the awesome Away3DLite. Playing with 1000s of polygons is very liberating, but still doesn&#8217;t mean we can slack off with the optimisation. It is important to take any opportunity to lessen the number of calculations performed per frame by the player. </p>
<p>To this end, I was just putting together a 2D layer above my 3D scene when I found that the camera.screen function (available in the standard Away3D library) that projects 3D coordinates(x,y,z) to 2D screen positions (x,y) wasn&#8217;t present.</p>
<p>In Away3DLite we have to calculate this ourselves. The salient information can be gained through a model or container&#8217;s viewMatrix3D property. To get an accurate screen position the the x,y,and z positions are drawn from viewMatrix3D. Each of x and y are divided by the z value and any screen offsets are applied. </p>
<p>Here is the method as a function:</p>
<blockquote><p>
public function calc2DCoords(screen_element:*):Point<br />
		{</p>
<p>			var posn:Vector3D = screen_element.viewMatrix3D.position<br />
			var screenX:Number = posn.x / posn.z;<br />
			var screenY:Number = posn.y / posn.z; </p>
<p>			return new Point(screenX+screenW_offset,screenY+screeH_offset)<br />
		}
</p></blockquote>
<p>Pass through a screen element (a model, primitive or object container) and the 2D result will be returned. The screenW_offset and screenH_offset are required if the &#8216;view&#8217; has been centred on the stage.</p>
<p>I have put together a demo here to demonstrate the function. I load a couple of models into the scene and let a 2D info panel follow each around the screen.<br />
<div id="attachment_217" class="wp-caption aligncenter" style="width: 460px"><a href="http://swingpantsflash.com/3dto2dprojection/overlay_3d_to_2d_mapping.html"><img src="http://flashlabs.files.wordpress.com/2010/01/translate3d_to_2d.jpg?w=655" alt="" title="Translate 3D coordinates to 2D screen position"   class="size-full wp-image-217" /></a><p class="wp-caption-text">Got to keep a close eye on those tubbies</p></div></p>
<p>Demo: <a href="http://swingpantsflash.com/3dto2dprojection/overlay_3d_to_2d_mapping.html">Translating 3D Coordinates to 2D Screen Position</a><br />
Source: <a href="http://swingpantsflash.com/3dto2dprojection/3DTo2DProjection.zip">ZIP</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flashlabs.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flashlabs.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flashlabs.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flashlabs.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flashlabs.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flashlabs.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flashlabs.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flashlabs.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flashlabs.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flashlabs.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flashlabs.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flashlabs.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flashlabs.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flashlabs.wordpress.com/215/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=215&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://swingpants.com/2010/01/15/away3dlite-translating-3d-coordinates-to-2d-screen-position/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1cebf29489913586137c5bdad0414c88?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">swingpants</media:title>
		</media:content>

		<media:content url="http://flashlabs.files.wordpress.com/2010/01/translate3d_to_2d.jpg" medium="image">
			<media:title type="html">Translate 3D coordinates to 2D screen position</media:title>
		</media:content>
	</item>
		<item>
		<title>Ranged Numbers. Non-Linear response curves for Sliders and TouchPads.</title>
		<link>http://swingpants.com/2009/11/18/ranged-numbers-non-linear-response-curves-for-sliders-and-touchpads/</link>
		<comments>http://swingpants.com/2009/11/18/ranged-numbers-non-linear-response-curves-for-sliders-and-touchpads/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 09:31:04 +0000</pubDate>
		<dc:creator>swingpants</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[exponential]]></category>
		<category><![CDATA[non-linear]]></category>
		<category><![CDATA[response curves]]></category>
		<category><![CDATA[slider]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[touchpad]]></category>

		<guid isPermaLink="false">http://swingpants.com/?p=170</guid>
		<description><![CDATA[I&#8217;ve been building a few apps recently and have found that a linear response over a range of numbers has been a poor solution. I needed to be able to apply different response curves to user interface components (knobs, sliders, touchpads) as well as on screen display objects, characters, etc. I needed a good name [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=170&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been building a few apps recently and have found that a linear response over a range of numbers has been a poor solution. I needed to be able to apply different response curves to user interface components (knobs, sliders, touchpads) as well as on screen display objects, characters, etc.</p>
<p>I needed a good name for the class, but instead came up with the pretty poor moniker &#8216;RangedNumbers&#8217;. I&#8217;ll change it when I come up with a better one. </p>
<p>So the idea is, a &#8216;ranged number&#8217; is instantiated, initialised for the required range then a simple call with a value in that range will result with a percentage that can be applied to the intended recipient accordingly. I realised that an inverted curve would be handy too, so have added that functionality.</p>
<p>I have included exponential and powered curves as well as linear. </p>
<p>So to use the ranged number system:</p>
<blockquote><p>
//Instantiate and Initialise<br />
var ranged_num:RangedNumber=new RangedNumber(min,max)<br />
//Where min is the minumum number in the range and max is the maximum</p>
<p>//In use:<br />
trace ( ranged_num.calculatedRangeNumber(value, curve_type, inverted) )<br />
//Where:<br />
// value is the value within the range to be calculated<br />
// curve_type is the type of response curve.<br />
//    Curve types: RangedNumber.LINEAR, RangedNumber.EXPONENTIAL, RangedNumber.POWERED<br />
// inverted is a boolean flag. True if the inverted response is required</p>
</blockquote>
<p>I have put together two demos to show the RangedNumber class in action:</p>
<p>Firstly using a Slider component. Grab the slider and watch how the markers are represented on all the displayed response curves.</p>
<div id="attachment_175" class="wp-caption aligncenter" style="width: 460px"><a href="http://swingpantsflash.com/range_number/ranged_number_slider.html"><img src="http://flashlabs.files.wordpress.com/2009/11/ranged_numbers_slider.jpg?w=655" alt="" title="Ranged Numbers: Slider Demo"   class="size-full wp-image-175" /></a><p class="wp-caption-text">A demonstration of how to implement non-linear response curves</p></div>
<p>Now here is the same demo but this time using a TouchPad. Click on the touchpad to engage. In this demo horizontal movement controls the standard curves and vertical the inverted.<br />
<div id="attachment_176" class="wp-caption aligncenter" style="width: 460px"><a href="http://swingpantsflash.com/range_number/ranged_number_touchpad.html"><img src="http://flashlabs.files.wordpress.com/2009/11/ranged_numbers_touchpad.jpg?w=655" alt="" title="Ranged Numbers: Touchpad Demo"   class="size-full wp-image-176" /></a><p class="wp-caption-text">How to implement non-linear response curves with a touchpad</p></div></p>
<p>The source for these demos and the Ranged Number class can be found here: <a href="http://swingpantsflash.com/range_number/number_ranged_demos.zip">Ranged Number ZIP</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flashlabs.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flashlabs.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flashlabs.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flashlabs.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flashlabs.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flashlabs.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flashlabs.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flashlabs.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flashlabs.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flashlabs.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flashlabs.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flashlabs.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flashlabs.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flashlabs.wordpress.com/170/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=170&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://swingpants.com/2009/11/18/ranged-numbers-non-linear-response-curves-for-sliders-and-touchpads/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1cebf29489913586137c5bdad0414c88?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">swingpants</media:title>
		</media:content>

		<media:content url="http://flashlabs.files.wordpress.com/2009/11/ranged_numbers_slider.jpg" medium="image">
			<media:title type="html">Ranged Numbers: Slider Demo</media:title>
		</media:content>

		<media:content url="http://flashlabs.files.wordpress.com/2009/11/ranged_numbers_touchpad.jpg" medium="image">
			<media:title type="html">Ranged Numbers: Touchpad Demo</media:title>
		</media:content>
	</item>
		<item>
		<title>Flash on the Beach (Part #1): Elevator Pitch&#8230; AS3 Genie Effect Transition.</title>
		<link>http://swingpants.com/2009/09/29/flash-on-the-beach-elevator-pitch-how-to-build-3-games-in-3-minutes-part1/</link>
		<comments>http://swingpants.com/2009/09/29/flash-on-the-beach-elevator-pitch-how-to-build-3-games-in-3-minutes-part1/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 22:30:39 +0000</pubDate>
		<dc:creator>swingpants</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Effect]]></category>
		<category><![CDATA[Conference]]></category>
		<category><![CDATA[Elevator Pitch]]></category>
		<category><![CDATA[FOTB]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[genie]]></category>
		<category><![CDATA[ginny]]></category>
		<category><![CDATA[transition]]></category>
		<category><![CDATA[wonderfl]]></category>

		<guid isPermaLink="false">http://swingpants.com/?p=150</guid>
		<description><![CDATA[My &#8216;build a game in three minutes&#8217; session at this year&#8217;s excellent Flash on the Beach somehow morphed into building three games in three minutes. My initial thinking was to code on the fly and put together something simple &#8211; I wanted physics and the ability to render a 3D version. It only took a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=150&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My &#8216;build a game in three minutes&#8217; session at this year&#8217;s excellent Flash on the Beach somehow morphed into building three games in three minutes. </p>
<p>My initial thinking was to code on the fly and put together something simple &#8211; I wanted physics and the ability to render a 3D version. It only took a couple of experiments to realise that trying to write AND compile in a strict 3 minutes would be near impossible. I needed some assets and wanted to produce these in the allotted time too. </p>
<p>While cogitating the pitch, I had a lot of game commissions and ideas come through my desk. I clicked that a Game Scratchpad would be a really handy app. Something that I could sketch out a game with &#8211; to demonstrate an idea during a brainstorm &#8211; at the speed of thought. </p>
<p>More on the Game Sketchpad in Part#2. See the last two minutes of the pitch here (not sure what happened to the first minute):<br />
<a href="http://www.youtube.com/watch?v=wLiKTdB89AA">http://www.youtube.com/watch?v=wLiKTdB89AA</a></p>
<p>In the meantime, I got asked by quite a few about the transition effect I used on my slides. To save time I did all of my presentation from within a swf. I wanted a fun quirky transition. The Genie (Ginny) effect is newish &#8211; I&#8217;d spotted it on <a href="http://wonderfl.net">wonderfl.net</a> by <a href="http://wonderfl.net/code/b8ec2e7155357ddc65d21eb8b1fa2e94c8363cfc#">Clockmaker</a> (inspired by <a href="http://fladdict.net">Fladdict</a>). So I grabbed the method and adapted it to allow me to fire it off from a given point &#8211; connecting relevant sprites (humorous and tasteless in good measure).</p>
<p>I have packaged the Genie effect <a href="http://swingpantsflash.com/genie_transition/genie_transition.zip">here</a> as a Class, with example implementation.</p>
<blockquote>
<p>//Usage<br />
import com.swingpants.effect.GenieBmd<br />
var gb:GenieBmd=new GenieBmd(400,300,20)// image width, height, number of segments<br />
gb.startGenie(bmd) // Bitmapdata<br />
gb.fireAtPoint(50,100,3) //x, y, speed (in secs)</p>
</blockquote>
<div id="attachment_176" class="wp-caption aligncenter" style="width: 460px"><a href="http://swingpantsflash.com/genie_transition/genietransition.html"><img src="http://swingpantsflash.com/genie_transition/genie_pic.jpg" alt="AS3 Genie (Ginny) Effect" title="#FOTB09. Jon Howard Genie Effect" width="450" height="330" class="size-full wp-image-176" /></a><p class="wp-caption-text">Swingpant's AS3 Genie Effect implementation</p></div>
<p>In part#2 I will explain how the Game Sketchpad works, the component parts, the swf and some source code.</p>
<p>Genie Effect (zip): <a href="http://swingpantsflash.com/genie_transition/genie_transition.zip">source</a><br />
Presentation (Youtube): <a href="http://www.youtube.com/watch?v=wLiKTdB89AA">video</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flashlabs.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flashlabs.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flashlabs.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flashlabs.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flashlabs.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flashlabs.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flashlabs.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flashlabs.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flashlabs.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flashlabs.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flashlabs.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flashlabs.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flashlabs.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flashlabs.wordpress.com/150/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=150&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://swingpants.com/2009/09/29/flash-on-the-beach-elevator-pitch-how-to-build-3-games-in-3-minutes-part1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1cebf29489913586137c5bdad0414c88?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">swingpants</media:title>
		</media:content>

		<media:content url="http://swingpantsflash.com/genie_transition/genie_pic.jpg" medium="image">
			<media:title type="html">#FOTB09. Jon Howard Genie Effect</media:title>
		</media:content>
	</item>
		<item>
		<title>Gradients and masks in actionscript</title>
		<link>http://swingpants.com/2009/04/30/gradients-and-masks-in-actionscript/</link>
		<comments>http://swingpants.com/2009/04/30/gradients-and-masks-in-actionscript/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 09:24:55 +0000</pubDate>
		<dc:creator>swingpants</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Alpha]]></category>
		<category><![CDATA[AS2]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[blendMode]]></category>
		<category><![CDATA[cacheAsBitmap]]></category>
		<category><![CDATA[Gradient]]></category>
		<category><![CDATA[Layer]]></category>
		<category><![CDATA[Masks]]></category>

		<guid isPermaLink="false">http://swingpants.com/?p=124</guid>
		<description><![CDATA[Quick post to describe how to apply a gradient mask to a display object in AS3 (&#38; AS2). #1 Put your gradient mask on the stage &#8211; lets call it gmask #2 Put the object to be masked on the stage. #3 Set both the mask and the &#8216;object to be masked&#8217; to cacheAsBitmap #4 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=124&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Quick post to describe how to apply a gradient mask to a display object in AS3 (&amp; AS2).</p>
<p><strong>#1</strong> Put your gradient mask on the stage &#8211; lets call it gmask<br />
<strong>#2</strong> Put the object to be masked on the stage.<br />
<strong>#3</strong> Set both the mask and the &#8216;object to be masked&#8217; to cacheAsBitmap<br />
<strong>#4</strong> Apply the mask to the object</p>
<p><strong>In #AS3</strong><br />
  <em>gmask.cacheAsBitmap = true<br />
  obj_to_be_masked.cacheAsBitmap = true<br />
  obj_to_be_masked.mask =gmask</em></p>
<p><strong>In #AS2</strong><br />
  <em>gmask.cacheAsBitmap = true<br />
  obj_to_be_masked.cacheAsBitmap = true<br />
  obj_to_be_masked.setMask(mask)</em></p>
<p>It really is as simple as this.<br />
<strong><em>Note to designers</em></strong>: Gradient masks can&#8217;t obviously be done directly from the IDE (see below), but these  three lines can be placed on the timeline if so desired.</p>
<p>To put a gradient mask on dynamic text you will need to place the text within a container (movieclip/sprite) and mask that. </p>
<p>The object to be masked can also contain animation, text or video though this will require a bit more processor as the bitmap will need to redraw on each frame. Often this is well worth it as the effect can be great.</p>
<p><strong>There is a way of achieving this same effect with no code at all and here it is:</strong></p>
<p><strong>#1</strong> Put your gradient mask on the stage &#8211; lets call it gmask<br />
<strong>#2</strong> Put the object to be masked on the stage.<br />
<strong>#3</strong> Put both of these items into a movieclip/sprite (the container) making sure the mask is on a layer above the object<br />
<strong>#4</strong> Give the mask a blend mode of &#8216;Alpha&#8217;<br />
<strong>#5</strong> Give the &#8216;container&#8217; a blend mode of &#8216;Layer&#8217;</p>
<p>And there you have it. Gradient masking achieved with blendModes and absolutely no code.</p>
<p><strong>Benchmarking the two gradient mask methods</strong>:<br />
I used each method to mask an embedded video &#8211; then placed an instance on the display list and ran at varying frame rates.<br />
Initially there was negligible difference between the code and blend mask methods. I ramped up the FPS to 120 and put four instances of the video on screen. With this set up the code method (cacheAsBitmap) was up to <strong>4%</strong> faster than the blendMode Mask method.</p>
<p>Conclusion: The code method is faster but very marginally. If you are desperate for a bit of extra juice go with code.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flashlabs.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flashlabs.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flashlabs.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flashlabs.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flashlabs.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flashlabs.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flashlabs.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flashlabs.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flashlabs.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flashlabs.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flashlabs.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flashlabs.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flashlabs.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flashlabs.wordpress.com/124/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=124&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://swingpants.com/2009/04/30/gradients-and-masks-in-actionscript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1cebf29489913586137c5bdad0414c88?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">swingpants</media:title>
		</media:content>
	</item>
		<item>
		<title>Fastest Way to Copy An Array: Concat() or Slice(0)</title>
		<link>http://swingpants.com/2009/03/12/fastest-way-to-copy-an-array-concat-or-slice0/</link>
		<comments>http://swingpants.com/2009/03/12/fastest-way-to-copy-an-array-concat-or-slice0/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 00:54:48 +0000</pubDate>
		<dc:creator>swingpants</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[Benchtesting]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Arrays]]></category>
		<category><![CDATA[benchtest]]></category>
		<category><![CDATA[concatenate]]></category>
		<category><![CDATA[slice]]></category>

		<guid isPermaLink="false">http://flashlabs.wordpress.com/?p=85</guid>
		<description><![CDATA[What is the fastest way to copy an array? Concat or Slice? There is only one way to find out. FIGHT! OK, so we can dismiss any kind of for-loop &#8211; far too slow, so that leaves us with: 1) array.concat() &#8211; i.e. concatenate an array onto nothing and deliver that as a new array. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=85&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>What is the fastest way to copy an array? Concat or Slice? There is only one way to find out. FIGHT!</p>
<p>OK, so we can dismiss any kind of for-loop &#8211; far too slow, so that leaves us with:<br />
    1)   array.concat() &#8211; i.e. concatenate an array onto nothing and deliver that as a new array.<br />
    2)   array.slice(0) &#8211; i.e. return a new array consisting of all of the elements of the old array &#8211; from 0 till the end (up to a max of 16777215)</p>
<p>I&#8217;ve set up an array with a cool 1million entries (ok, it is not big, and it is not clever so it certainly isn&#8217;t cool). I need to copy this. The following code executes each method once on every iteration. It keeps a running total and records the average time each takes. I&#8217;ve limited the code to 100 iterations.</p>
<blockquote>
<p>package<br />
{<br />
	import flash.display.Sprite;<br />
	import flash.events.Event;<br />
	import flash.events.MouseEvent;<br />
	import flash.text.TextField;<br />
    import flash.utils.*;<br />
	public class TestConcat extends Sprite<br />
	{<br />
		private var iteration_count:int=0<br />
		private var concat_total:int=0<br />
		private var slice_total:int=0<br />
		private var clone_total:int=0<br />
		private var tf:TextField = new TextField()<br />
		private var test_array:Array = [];</p>
<p>		public function TestConcat():void<br />
		{<br />
			tf.x = tf.y = 100; tf.width = 600;<br />
			addChild(tf)</p>
<p>			//Set up array to copy<br />
			for(var i:int = 0; i &lt; 1000000; i++) test_array.push(i);<br />
			//Mouse click to rerun test<br />
			stage.addEventListener(MouseEvent.CLICK, go);<br />
			//First run<br />
			go()<br />
		}</p>
<p>		private function go(e:Event = null):void<br />
		{<br />
			iteration_count=concat_total=slice_total=clone_total=0<br />
			addEventListener(Event.ENTER_FRAME, iterate)<br />
		}</p>
<p>		//Loop through tests<br />
		private function iterate(e:Event=null):void<br />
		{<br />
			concat_total +=testConcat()<br />
			slice_total += testSlice()<br />
			clone_total += testByteArrayClone()<br />
			iteration_count++<br />
			tf.text = &quot;Av. Concat time=&quot; + (concat_total / iteration_count)<br />
					+ &quot;ms  Av. Slice time=&quot; + (slice_total / iteration_count)<br />
					+ &quot;ms  Av. BA Clone time=&quot; + (clone_total / iteration_count) + &quot;ms&quot;;<br />
			if(iteration_count&lt;99) removeEventListener(Event.ENTER_FRAME,iterate)<br />
		}</p>
<p>		//test array slice<br />
		private function testSlice():int<br />
		{<br />
			var time_slice_start:Number = getTimer();<br />
			var slice_copy:Array = test_array.slice(0);<br />
			return getTimer()-time_slice_start<br />
		}</p>
<p>		//test array concat<br />
		private function testConcat():int<br />
		{<br />
			var time_concat_start:Number = getTimer();<br />
			var concat_copy:Array = test_array.concat();<br />
			return getTimer()-time_concat_start<br />
		}</p>
<p>		//test BA Clone method<br />
		private function testByteArrayClone():int<br />
		{<br />
			var time_concat_start:Number = getTimer();<br />
			var concat_copy:Array = clone(test_array);<br />
			return getTimer()-time_concat_start<br />
		}</p>
<p>		//Clone method for Deep Objects(via Bruno)<br />
		private function clone(source:Object):*<br />
		{<br />
			var myBA:ByteArray = new ByteArray();<br />
			myBA.writeObject(source);<br />
			myBA.position = 0;<br />
			return(myBA.readObject());<br />
		}<br />
	}<br />
}</p>
</blockquote>
<p>On my laptop I&#8217;m clocking the <strong>concat at 14ms</strong> and the <strong>slice at over 29ms</strong>. </p>
<p>So a conclusive result. concat is twice the speed (with large arrays &#8211; the difference diminishes considerably with smaller arrays)</p>
<p>Give the code a few run throughs and see what you get. Let me know if your results are markedly different.</p>
<p>UPDATED:<br />
I have updated the code and added a swf to try out <a href="http://www.swingpantsflash.com/array_copy/">here</a> and the source code <a href="http://www.swingpantsflash.com/array_copy/TestConcat.as">here</a><br />
<div id="attachment_350" class="wp-caption aligncenter" style="width: 460px"><a href="http://flashlabs.files.wordpress.com/2009/03/copy_test.jpg"><img src="http://flashlabs.files.wordpress.com/2009/03/copy_test.jpg?w=655" alt="Fastest way to copy an array" title="copy_test"   class="size-full wp-image-350" /></a><p class="wp-caption-text">Test the array copy for yourself</p></div><br />
I&#8217;ve also added in a test for the Byte Array Clone method suggested by Bruno (see his comments below). This method seems a great one for copying &#8216;deep&#8217; arrays &#8211; arrays of complex objects (arrays, objects or other types). In this context and test (copying shallow arrays) the instantiation, writing and reading adds too much overhead. I&#8217;ll need to test this in a useful context: with deep arrays.</p>
<p>Demo: <a href="http://www.swingpantsflash.com/array_copy/">Array Copy test</a><br />
Source: <a href="http://www.swingpantsflash.com/array_copy/TestConcat.as">Source.as</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flashlabs.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flashlabs.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flashlabs.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flashlabs.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flashlabs.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flashlabs.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flashlabs.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flashlabs.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flashlabs.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flashlabs.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flashlabs.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flashlabs.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flashlabs.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flashlabs.wordpress.com/85/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=85&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://swingpants.com/2009/03/12/fastest-way-to-copy-an-array-concat-or-slice0/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1cebf29489913586137c5bdad0414c88?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">swingpants</media:title>
		</media:content>

		<media:content url="http://flashlabs.files.wordpress.com/2009/03/copy_test.jpg" medium="image">
			<media:title type="html">copy_test</media:title>
		</media:content>
	</item>
	</channel>
</rss>
