<?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>sevenson.com.au &#187; ActionScript</title>
	<atom:link href="http://www.sevenson.com.au/category/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sevenson.com.au</link>
	<description>The online presence of Andrew Sevenson</description>
	<lastBuildDate>Sun, 11 Jul 2010 12:37:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>DisplacementMapFilter Tester</title>
		<link>http://www.sevenson.com.au/actionscript/displacementmapfilter-tester/</link>
		<comments>http://www.sevenson.com.au/actionscript/displacementmapfilter-tester/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 04:54:09 +0000</pubDate>
		<dc:creator>Andrew Sevenson</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.sevenson.com.au/?p=389</guid>
		<description><![CDATA[Recently I did some work on the a project that required me to use some Displacement Maps. I have never used them before, but after playing with them for a bit I soon realised something&#8230; they are very awesome. They do take a little bit of getting used to, so to help with the experimentation [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sevenson.com.au/content/uploads/2009/09/icon.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/09/icon.jpg" alt="" title="Displacement Tester Icon" width="250" height="139" class="alignright size-full wp-image-518" /></a>Recently I did some work on the a project that required me to use some Displacement Maps.  I have never used them before, but after playing with them for a bit I soon realised something&#8230; they are very awesome.</p>
<p>They do take a little bit of getting used to, so to help with the experimentation I created this little app that makes it easy to test out different image and maps combinations.</p>
<p><span id="more-389"></span></p>
<p><a href="http://www.sevenson.com.au/content/uploads/2009/09/screengrab.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/09/screengrab-300x166.jpg" alt="" title="DisplacementMap Tester Screen Grab" width="300" height="166" class="alignleft size-medium wp-image-521" /></a>The app lets you load in your own images (or use some of my defaults), adjust all the displacement settings and see the final result. It also generates ActionScript 3 code you will need to re-create the effect in your own project.</p>
<p><button id="displacementBtn" rel="#dispmappopup" type="button">Check out DisplacementMap Tester</button></p>
<div class="overlay" id="dispmappopup" style="width:910px;height:510px;background-image:url(http://www.sevenson.com.au/content/actionscript/displacement/largepopupbg.png);">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_swfloader_405675397"
			class="flashmovie"
			width="900"
			height="500">
	<param name="movie" value="http://www.sevenson.com.au/content/common/swfloader.swf" />
	<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/displacement/dispmaptest.swf&amp;clickToLoad=false&amp;corners=all" />
	<param name="quality" value="high" />
	<param name="wmode" value="window" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.sevenson.com.au/content/common/swfloader.swf"
			name="fm_swfloader_405675397"
			width="900"
			height="500">
		<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/displacement/dispmaptest.swf&amp;clickToLoad=false&amp;corners=all" />
		<param name="quality" value="high" />
		<param name="wmode" value="window" />
	<!--<![endif]-->
		
<div class="missingFlash">There should be a flash movie here?</div>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object></div>
<p>Now, I was going to attempt and explain what a Displacement Map is and how it all works, but I realised that there are already a bunch of resources out that that can do a better job than me.  One in particular that I found quite helpful was this <a href="http://www.emanueleferonato.com/2007/12/03/understanding-flash-displacement-map-filter/" target="_blank">article</a> written by Emanuele Feronato.  Most of it is written in AS2, but the concepts are still the same.</p>
<h3>Update</h3>
<p>I recently created a quick AIR version of this tester so that you don&#8217;t need a net connection to test custom images.  Its not anything fancy.  Just a direct port of this web version, but with local file read access.  </p>
<p>You can download the AIR version here: <a href="http://www.sevenson.com.au/wp-content/plugins/download-monitor/download.php?id=6" title="Downloaded 88 times">Displacement Map Tester (Air Verion)</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sevenson.com.au/actionscript/displacementmapfilter-tester/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing Regular Expressions in ActionScript 3</title>
		<link>http://www.sevenson.com.au/actionscript/testing-regular-expressions/</link>
		<comments>http://www.sevenson.com.au/actionscript/testing-regular-expressions/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 10:21:17 +0000</pubDate>
		<dc:creator>Andrew Sevenson</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.sevenson.com.au/?p=368</guid>
		<description><![CDATA[I&#8217;m by no means an expert on Regular Expressions. I mean, I get what they do, and can see their awesomeness, but damn they do my head in sometimes. To help myself out, I wrote a quick little Flex app that lets you test how a regular expression will work with a particular string. It [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sevenson.com.au/content/uploads/2009/09/icon2.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/09/icon2.jpg" alt="" title="Regular Expression Icon" width="250" height="190" class="alignright size-full wp-image-540" /></a>I&#8217;m by no means an expert on Regular Expressions.  I mean, I get what they do, and can see their awesomeness, but damn they do my head in sometimes.</p>
<p>To help myself out, I wrote a quick little Flex app that lets you test how a regular expression will work with a particular string.  It lets you try out all the Flash Regular Expression methods and see each of the results.</p>
<p>To top it all off, I put together a quick overview of the different Flash Regular Expression methods that are available, as well as a short overview of the Regular Expression syntax.</p>
<p>You can check it all out right here&#8230;</p>
<p><span id="more-368"></span><br />
<a name="flashdemo"></a>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_swfloader_698394827"
			class="flashmovie"
			width="650"
			height="400">
	<param name="movie" value="http://www.sevenson.com.au/content/common/swfloader.swf" />
	<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/regexp/regexp.swf&amp;previewURL=http://www.sevenson.com.au/content/actionscript/regexp/preview.jpg&amp;clickToLoad=true&amp;corners=''" />
	<param name="quality" value="high" />
	<param name="wmode" value="transparent" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.sevenson.com.au/content/common/swfloader.swf"
			name="fm_swfloader_698394827"
			width="650"
			height="400">
		<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/regexp/regexp.swf&amp;previewURL=http://www.sevenson.com.au/content/actionscript/regexp/preview.jpg&amp;clickToLoad=true&amp;corners=''" />
		<param name="quality" value="high" />
		<param name="wmode" value="transparent" />
	<!--<![endif]-->
		
<div class="missingFlash">Flash should be here somewhere?</div>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Hope that helps you out!</p>
<h2 id="regexpmethods">Regular Expression Methods</h2>
<p>Here is are the Regular Expression methods that are used in AS3</p>
<hr/>
<h4>RegExp.test(string:String):Boolean</h4>
<p>Simply tests to see if the pattern is matched anywhere in the string</p>
<ul>
<li>if &#8216;g&#8217; flag is set it searches from the .lastIndex, and also sets it after each .test()</li>
<li>if &#8216;g&#8217; is not set, then the search is always done from the start</li>
</ul>
<p><a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/RegExp.html#test()" title="ActionScript Language Reference - RegExp.test()">Click here</a> for the official documentation</p>
<hr/>
<h4>RegExp.exec(string:String):Object</h4>
<p>Returns an object with with various properties relating to the pattern. The properties are</p>
<ul>
<li>[0],[1] etc &#8211; Array like access &#8211; [pattern, group1, group2]</li>
<li>index &#8211; position of the match</li>
<li>input &#8211; the string that was tested</li>
</ul>
<p>If there is no match then this will return null.</p>
<ul>
<li>if the &#8216;g&#8217; flag is set, it can be called multiple times</li>
<li>if the &#8216;g&#8217; flag is not set, it will only return the first match</li>
</ul>
<p><a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/RegExp.html#exec()" title="ActionScript Language Reference - RegExp.exec()">Click here</a> for the official documentation</p>
<hr/>
<h4>String.replace(pattern:RegExp, replacement:String):Boolean</h4>
<p>Replaces the pattern in the string with the replacement string.</p>
<ul>
<li>if &#8216;g&#8217; flag is set it replaces all matches in the string</li>
<li>if &#8216;g&#8217; is not set,only the first match is replaced</li>
<li>you can use group references like $1, $2, $`, $&#038;, $&#8217;</li>
</ul>
<p><a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/String.html#replace()" title="ActionScript Language Reference - String.replace()">Click here</a> for the official documentation</p>
<hr/>
<h4>String.search(pattern:RegExp):int</h4>
<p>Returns the index of where the pattern is found in the string.</p>
<ul>
<li>returns -1 if there is no match</li>
<li>ignores the &#8216;g&#8217; flag and &#8216;.lastIndex&#8217; property</li>
</ul>
<p><a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/String.html#search()" title="ActionScript Language Reference - String.search()">Click here</a> for the official documentation</p>
<hr/>
<h4>String.match(pattern:RegExp):Array</h4>
<p>Returns an Array populated with values relating to the pattern.</p>
<ul>
<li>if the &#8216;g&#8217; flag is not set, the array will be in the form of [fullpattern, group 1, group2]</li>
<li>if the &#8216;g&#8217; flag is set, the array will contain all the possible full pattern matches &#8211; [fullpattern1, fullpattern2]</li>
</ul>
<p><a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/String.html#match()" title="ActionScript Language Reference - String.match()">Click here</a> for the official documentation</p>
<hr/>
<h2 id="syntax">Regular Expression Syntax</h2>
<p>Here is a quick run-through of the regular expression syntax as a bit of reference.</p>
<h3>Constructors</h3>
<p>There are two ways to set up a regular expression.</p>
<table class="reftable">
<tr>
<td><strong>/pattern/flags</strong></td>
<td><strong>Literal:</strong><br/>Just type the shorthand method, and bam, regular expression</td>
</tr>
<tr class="odd">
<td><strong>new RegExp(pattern:String, flags:String)</strong></td>
<td><strong>Constructor:</strong><br/>Construct it like any type of object, passing in a string of the pattern and the flags as parameters.<br/>Note: If using RegExp then you need to escape sequences &#8211; \\d instead of the normal \d</td>
</tr>
</table>
<h3>Flags</h3>
<p>Flags change the way the regular expression works. They also can effect the results of the regular expression methods in different ways.</p>
<table class="reftable">
<tr>
<td><strong>g</strong></td>
<td>Global</td>
</tr>
<tr class="odd">
<td><strong>i</strong></td>
<td>Case-insensitive</td>
</tr>
<tr>
<td><strong>m</strong></td>
<td>Multi-line</td>
</tr>
<tr class="odd">
<td><strong>s</strong></td>
<td>Dot all</td>
</tr>
<tr>
<td><strong>x</strong></td>
<td>Extended</td>
</tr>
</table>
<h3>Meta Characters</h3>
<p>Meta Characters are characters that have a special meaning when used inside a Regular Expression pattern.</p>
<table class="reftable">
<tr>
<td><strong>^</strong> (caret)</td>
<td>Matches the start of a string<br/>If using &#8216;multiline&#8217; (m) then it will match the start of a line.</td>
</tr>
<tr class="odd">
<td><strong>$</strong></td>
<td>Matches the end of a string<br/>If using multiline (m) then it will match the end of a line.</td>
</tr>
<tr>
<td><strong>\</strong></td>
<td>Escapes special characters. \d, \w, \\, etc </td>
</tr>
<tr class="odd">
<td><strong>.</strong> (period)</td>
<td>Matches any single character. <br/>If using the &#8216;dot all&#8217; (s) flag this will match new lines as well.</td>
</tr>
<tr>
<td><strong>*</strong></td>
<td>Matches the previous character 0 or more times.</td>
</tr>
<tr class="odd">
<td><strong>+</strong></td>
<td>Matches the previous character 1 or more times.</td>
</tr>
<tr>
<td><strong>?</strong></td>
<td>Matches previous character 0 or 1 time</td>
</tr>
<tr class="odd">
<td><strong>(  )</strong></td>
<td>Groups
<ul>
<li>define a scope of a quantifier (walla){1,2}</li>
<li>confine scope of the | alternator</li>
<li>used to define back references</li>
</ul>
</td>
</tr>
<tr>
<td><strong>[ ]</strong></td>
<td>Character Classes
<ul>
<li>Defines possible for matches for a single character</li>
<li>You can use hyphens to define a range &#8211; [A-Za-z0-9]</li>
<li>Backslash (\) escapes ] and -</li>
<li>^ in first position negates set</li>
<li>note &#8211; meta characters are treated as normal characters and need to be escaped to work &#8211; [\\d]</li>
</ul>
</td>
</tr>
<tr class="odd">
<td><strong>|</strong></td>
<td>Alternation / Logical Or &#8211; allows you to test between multiple patters<br/>(abc|xyz) matches abc or xyz<br/>/1|2|3|4|5/ equals [12345]</td>
</tr>
</table>
<h3>Meta Sequences</h3>
<p>Meta Sequences are special string that can be used to represent specific characters in a pattern.</p>
<table class="reftable">
<tr>
<td><strong>{n}<br/>{n,}<br/>{n,m}</strong></td>
<td>Numeric quantifier
<ul>
<li>A{27} = A 27 times</li>
<li>A{3,} = A 3 or more times</li>
<li>A{3,5} = A 3 to 5 times</li>
</ul>
</td>
</tr>
<tr class="odd">
<td><strong>\b</strong></td>
<td>Matches the position between a word character and a non-word character.  If first or last character in the string is a word character, also matches the start/end.</td>
</tr>
<tr>
<td><strong>\B</strong></td>
<td>Matches the position between 2 word characters.  Also matches the position between 2 non word characters.</td>
</tr>
<tr class="odd">
<td><strong>\d<br/>\D</strong></td>
<td>Decimals<br/>Non-decimals</td>
</tr>
<tr>
<td><strong>\f<br/>\n<br/>\r<br/>\v</strong></td>
<td>Form feed<br/>Newline<br/>Return<br/>Vertical feed</td>
</tr>
<tr class="odd">
<td><strong>\s<br/>\S</strong></td>
<td>Whitespace &#8211; space, tab, newline, return<br/>Non-whitespace</td>
</tr>
<tr>
<td><strong>\t</strong></td>
<td>Tab character</td>
</tr>
<tr class="odd">
<td><strong>\w<br/>\W</strong></td>
<td>Word character &#8211; A-Z, a-z, 0-9,_<br/>Non-word character</td>
</tr>
<tr>
<td><strong>\unnnn</strong></td>
<td>Matches unicode nnnn</td>
</tr>
<tr class="odd">
<td><strong>\xnn</strong></td>
<td>ascii character</td>
</tr>
</table>
<h3>Greedy Vs Non-Greedy</h3>
<p>Normally quantifiers like <strong>*</strong> and <strong>+</strong> are greedy, as in, they will try and match as much as they can.  They can be made lazy by adding a <strong>?</strong> afterward.</p>
<table class="reftable">
<tr>
<td>/&lt;p&gt;.*/&lt;/p&gt;/</td>
<td>greedy &#8211; the * will match as many characters as possible</td>
</tr>
<tr class="odd">
<td>/&lt;p&gt;.*?/&lt;/p&gt;/</td>
<td>lazy &#8211; the * will match the least amount of characters</td>
</tr>
</table>
<h3>Capturing sub-strings</h3>
<p>Sometimes when you are looking for a pattern in a string you need to work with a sub-string.  Maybe it is to replace it, or reference it is a new string.  Maybe you don&#8217;t know what exactly it is you have to match. That&#8217;s where this stuff comes in.</p>
<table class="reftable">
<tr>
<td><strong>\1, \2, etc</strong></td>
<td>Back reference<br/>Matches an earlier defined group in the pattern<br/>eg: /(\d+)-by-<strong>\1</strong>/ matches 48-by-48</td>
</tr>
<tr class="odd">
<td><strong>$1 &#8211; $nn</strong></td>
<td>Group references<br/>Can be used to reference groups in the String.replace() and RegExp.exec() methods<br />
<code class="as"><br />
	var str:String = "Hi, Sev";<br />
	str = str.replace(/Hi, (w+)/,"$1, hello");<br />
	trace(str);		// Sev, hello<br />
</code>
		</td>
</tr>
<tr>
<td><strong>$$</strong></td>
<td>Puts a $ in the replacement text (not really a sub-string reference, but sorta matches up with this stuff.)</td>
</tr>
<tr class="odd">
<td><strong>$&#038;</strong></td>
<td>References the fully matched string</td>
</tr>
<tr>
<td><strong>$`</strong></td>
<td>References the string preceding the matched pattern</td>
</tr>
<tr class="odd">
<td><strong>$&#8217;</strong></td>
<td>References the string following the matched pattern</td>
</tr>
<tr>
<td><strong>?:</strong></td>
<td>Non-capturing Group<br/>Sometimes you don&#8217;t want a group to be captured for back references, etc.  This is can be done by adding <strong>?:</strong> at the start of the group.<br/>eg: /(?:group)/</td>
</tr>
<tr class="odd">
<td><strong>(?P&lt;name&gt;.*):</strong></td>
<td>Named groups<br/>When used in RegExp.exec(), the group will be stored under a property with the &#8216;name&#8217;.<br/>Note: this is an AS3 only Regular Expression syntax.</td>
</tr>
</table>
<h2>Links</h2>
<p>Here are some links to some sites that help with regular expressions.</p>
<ul>
<li><a href="http://www.regular-expressions.info/" title="Regular Expressions Info">http://www.regular-expressions.info/</a></li>
<li><a href="http://regexlib.com/" title="Regular Expressions Library">http://regexlib.com/</a></li>
<li><a href="http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&#038;file=00000112.html" title="Flash LiveDocs Reference">Flash LiveDocs Reference on Regular Expression Syntax</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.sevenson.com.au/actionscript/testing-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Faking Depth of Field in Papervision 3D</title>
		<link>http://www.sevenson.com.au/actionscript/depth-of-field/</link>
		<comments>http://www.sevenson.com.au/actionscript/depth-of-field/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 12:56:51 +0000</pubDate>
		<dc:creator>Andrew Sevenson</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.sevenson.com.au/?p=350</guid>
		<description><![CDATA[A while back I was given my first flash project that required me to use Papervision 3D. If that wasn&#8217;t daunting enough, the design of the project required that there be a depth of field effect on the elements &#8211; something that papervision cannot do. (If i am wrong about that, please don&#8217;t tell me [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sevenson.com.au/content/uploads/2009/08/icon.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/08/icon.jpg" alt="" title="Depth Of Field Icon" width="250" height="190" class="alignright size-full wp-image-545" /></a>A while back I was given my first flash project that required me to use <a href="http://www.papervision3d.org/">Papervision 3D</a>.    If that wasn&#8217;t daunting enough, the design of the project required that there be a depth of field effect on the elements &#8211; something that papervision cannot do.  (If i am wrong about that, please don&#8217;t tell me now&#8230;)</p>
<p>After learning the basics of papervision &#8211; which has plenty of tutorials on the interwebs &#8211; I started brainstorming an approach for faking depth of field.  Here is what I came up with.</p>
<p><span id="more-350"></span></p>
<p>Simplifying the concept, I basically just needed to &#8216;blur&#8217; the objects as they moved close to or far away from the camera.  I couldn&#8217;t blur the object itself, but I could change the textures on the fly, so that became the basis of my approach.</p>
<p>I couldn&#8217;t just blur the textures on the objects because the edges would not look right.  The blur needed to extend past the edge of the objects.  My solution for this was to set up extra 3d planes for each of the objects that needed blur.  As the objects moved, their distance from the camera was tested.  If they were outside the threshold area, the blurred plane object was substituted in, and the blurry textures were swapped around based on the particular distance.</p>
<p>It seemed to work pretty well.  Here is a slightly simplified version of the concept, using just the planes.  As you move the mouse around, you will see the planes appear to blur &#8211; this is the textures swapping</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_swfloader_439808609"
			class="flashmovie"
			width="650"
			height="400">
	<param name="movie" value="http://www.sevenson.com.au/content/common/swfloader.swf" />
	<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/depthoffield/depthoffield.swf&amp;previewURL=http://www.sevenson.com.au/content/actionscript/depthoffield/preview.jpg&amp;clickToLoad=true" />
	<param name="quality" value="high" />
	<param name="scale" value="noscale" />
	<param name="wmode" value="window" />
	<param name="allowscriptaccess" value="always" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.sevenson.com.au/content/common/swfloader.swf"
			name="fm_swfloader_439808609"
			width="650"
			height="400">
		<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/depthoffield/depthoffield.swf&amp;previewURL=http://www.sevenson.com.au/content/actionscript/depthoffield/preview.jpg&amp;clickToLoad=true" />
		<param name="quality" value="high" />
		<param name="scale" value="noscale" />
		<param name="wmode" value="window" />
		<param name="allowscriptaccess" value="always" />
	<!--<![endif]-->
		
<div class="missingFlash">There is supposed to be some flash stuff here</div>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Now for the funky bit.  Because there were a bunch of different textures I needed to work with, I didn&#8217;t want to have to created every level of blur for every image.  It would be burden on my time and increase download times.</p>
<p>What I ended up doing was created a method that took in one texture and generated all of the blurs for me.  Each of the different blurs was then stored in an array so that I could easily switch between them.</p>
<p>This is the code that I used, but looking at it now I could have done it a bit better dropping out the &#8216;draw()&#8217; method and applying the blur to the BitmapData directly.</p>
<p><code class="as"><br />
	/**<br />
	 * Generates an array of bitmap data objects ranging from no blur to the blur amount<br />
	 * @param	origBitmapData	- the original bitmap to blur<br />
	 * @param	blurAmount		- the maximum amount of blur to create<br />
	 * @param	steps			- the number of various blur amounts to generate<br />
	 * @return  An array of BitmapData objects<br />
	 */<br />
	public function generateBlurredBitmapArray(origBitmapData:BitmapData, blurAmount:Number = 40, steps:Number=8):Array {<br />
		// set up a return array to hold the data<br />
		var returnArray:Array = [];<br />
		// create the blur filter<br />
		var blur:BlurFilter = new BlurFilter(0,0,2);<br />
		// generate a sprite to apply the blur to<br />
		var s:Sprite = new Sprite();<br />
		// create a bitmap to hold the original bitmap data - add it to the sprite<br />
		var b:Bitmap = new Bitmap(origBitmapData, "auto", true);<br />
		s.addChild(b);<br />
		// position it in the centre<br />
		b.x = b.y = blurAmount;<br />
		// loop through and generate the required number of blurs<br />
		for (var i:uint = 0; i < steps; i++) {<br />
			// adjust the blur and apply it to the sprite<br />
			blur.blurX = blur.blurY = blurAmount * (i / (steps - 1))<br />
			s.filters = [blur];<br />
			// generate the new bitmap data<br />
			var newBmpData:BitmapData = new BitmapData(origBitmapData.width + (blurAmount * 2), origBitmapData.height + (blurAmount * 2), true, 0x00ffffff);<br />
			// draw the sprite to it<br />
			newBmpData.draw(s, null, null, null, null, true);<br />
			// add this to the return array<br />
			returnArray.push(newBmpData);<br />
		}<br />
		// return the array<br />
		return returnArray;<br />
	}<br />
</code></p>
<p>That's about it.  Hope that helps you out - let me know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sevenson.com.au/actionscript/depth-of-field/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Separating Axis Theorem (SAT) Explanation</title>
		<link>http://www.sevenson.com.au/actionscript/sat/</link>
		<comments>http://www.sevenson.com.au/actionscript/sat/#comments</comments>
		<pubDate>Sun, 24 May 2009 09:13:57 +0000</pubDate>
		<dc:creator>Andrew Sevenson</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://127.0.0.1/wordpress/?p=196</guid>
		<description><![CDATA[A quick and basic explanation of how SAT collision detection works, as well as some links and code you can download.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sevenson.com.au/content/uploads/2009/05/icon4.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/05/icon4.jpg" alt="" title="SAT Icon" width="250" height="191" class="alignright size-full wp-image-561" /></a>Separating Axis Theorem (SAT) is a technique for calculating collisions between convex polygons.</p>
<p>I&#8217;m by no means an expert on it, but after the need arose for me to do some collision detection I did a pile of reading and finally got it working in ActionScript 3.</p>
<p>I thought I would share what I learned in the hope others wouldn&#8217;t suffer so much <img src='http://www.sevenson.com.au/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><span id="more-196"></span></p>
<p>When I found myself in a need to calculate collisions between polygons in flash, I came across a method known as Separating Axis Theorem (SAT).  The only problem I had was that I really struggled to get a grasp on it.</p>
<p>After a lot of reading about collision detection, and looking at code samples, it all finally clicked.</p>
<p>To help out the other non-maths minded people I thought I would write this quick explanation to run through the basic principles of how it works. I&#8217;ve also included a demo using SAT collision detection, as well as some ActionScript 3 classes you can download and use.</p>
<p><strong>Note:</strong> SAT does require a bit of work with vector math, so it may be a good idea to brush up on your vectors before getting too far into SAT.</p>
<h3 id="demo">Interactive Demo:</h3>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_swfloader_948797034"
			class="flashmovie"
			width="650"
			height="400">
	<param name="movie" value="http://www.sevenson.com.au/content/common/swfloader.swf" />
	<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/sat/sat.swf&amp;previewURL=http://www.sevenson.com.au/content/actionscript/sat/preview.jpg&amp;clickToLoad=true" />
	<param name="quality" value="high" />
	<param name="wmode" value="transparent" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.sevenson.com.au/content/common/swfloader.swf"
			name="fm_swfloader_948797034"
			width="650"
			height="400">
		<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/sat/sat.swf&amp;previewURL=http://www.sevenson.com.au/content/actionscript/sat/preview.jpg&amp;clickToLoad=true" />
		<param name="quality" value="high" />
		<param name="wmode" value="transparent" />
	<!--<![endif]-->
		
<div class="missingFlash">Interactive Demo should be here</div>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Use your mouse to drag the shapes around. Whilst dragging, use the arrow keys to change the scale and rotation of the shapes.  When the two shapes collide they will change colour (red) and show a possible reaction (grey).</p>
<h3 id="rundown">The quick rundown</h3>
<p>Basically, the goal of SAT (and every other collision detection) is to test and see if is a gap between two shapes. The method that SAT uses is what makes it unique.</p>
<p>The best analogy I have heard for SAT technique is like this:</p>
<p>Imagine taking a torch and shining it on the two shapes you are testing from different angles. What sort of shadows would it cast on the wall behind it?</p>
<p><a href="http://www.sevenson.com.au/content/uploads/2009/05/shadows.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/05/shadows.jpg" alt="" title="Illustration showing how a gap can be seen between 2 polygons" width="650" height="141" class="alignnone size-full wp-image-644" /></a></p>
<p>If you work your way around the shapes and never find a gap in the shadows then the objects must be touching. If you find a gap, then they are clearly not touching.</p>
<p>From a programming point of view it would be to intensive to check every possible angle. Luckily, due to the nature of the polygons, there is only a few key angles you need to check.</p>
<p>The angles you need to check are the same as the sides of the polygons. This means that the maximum number of angles to check is the sum of the number of sides the two shapes you are testing have. Eg. Two pentagons would require ten angles to be checked.</p>
<p><a href="http://www.sevenson.com.au/content/uploads/2009/05/angles.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/05/angles.jpg" alt="" title="This shows how the angles you need to test is related to the sides of the shapes you are testing" width="650" height="107" class="alignnone size-full wp-image-643" /></a></p>
<p><a name="codeprocess"></a></p>
<h3>So how do you make it work in code?</h3>
<p>It&#8217;s a simple but repetitive method, so here is a basic step by step:</p>
<p><strong>Step 1.</strong> Take one side from one of the polygons you are testing and find the normal (perpendicular) vector from it. This will be the &#8216;axis&#8217;.</p>
<p><a href="http://www.sevenson.com.au/content/uploads/2009/05/step1.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/05/step1.jpg" alt="" title="This shows the axis that you will need to project onto when testing this side." width="520" height="220" class="alignnone size-full wp-image-565" /></a></p>
<p><strong>Step 2.</strong> Loop through every point on the first polygon and project it onto the axis. (Keep track of the highest and lowest values found for this polygon)</p>
<p><a href="http://www.sevenson.com.au/content/uploads/2009/05/step2.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/05/step2.jpg" alt="" title="Each point of the first shape is projected onto the axis we found in Step 1." width="520" height="220" class="alignnone size-full wp-image-566" /></a></p>
<p><strong>Step 3.</strong> Do the same for the second polygon.</p>
<p><a href="http://www.sevenson.com.au/content/uploads/2009/05/step3.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/05/step3.jpg" alt="" title="Each point from the second shape is also projected onto the axis." width="520" height="220" class="alignnone size-full wp-image-567" /></a></p>
<p><strong>Step 4.</strong> Check the values you found and see if they overlap.</p>
<p><a href="http://www.sevenson.com.au/content/uploads/2009/05/step4.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/05/step4.jpg" alt="" title="From this angle a gap can be seen in the &#039;shadows&#039; that the two shapes are projecting." width="520" height="220" class="alignnone size-full wp-image-568" /></a></p>
<p>If you find a gap between the two &#8216;shadows&#8217; you have projected onto the axis then the shapes must not intersect. However, if there is no gap, then they might be touching and you have to keep checking until you have gone through every side of both polygons.  If you get through them all without finding a gap then they collide.</p>
<p>That&#8217;s basically it.</p>
<p>As an added bonus, if you keep track of which axis has the smallest shadow overlap (and how much of an overlap that was) then you can apply that value to the shapes to separate them.</p>
<h4>What about circles?</h4>
<p>Testing a circle against a polygon in SAT is a little bit strange but it can be done.</p>
<p>The main thing to note is that a circle does not have any sides so there is no obvious axis that you can test against.  There is one &#8216;not so obvious&#8217; axis you do need to test however. This is the axis that runs from the centre of the circle to the closest vertex on the polygon.</p>
<p><a href="http://www.sevenson.com.au/content/uploads/2009/05/circle.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/05/circle.jpg" alt="" title="This is the axis you need to find when testing a circle for collision." width="321" height="220" class="alignnone size-full wp-image-563" /></a></p>
<p>After that it is just a matter of going through the usual routine of looping through every axis on the other polygon and checking for overlaps.</p>
<p>Oh, and in case you are wondering how to project a circle onto the axis, you simply project the centre point of the circle and then add and subtract the radius.</p>
<p><a name="procon"></a></p>
<h3>Pro&#8217;s and Con&#8217;s</h3>
<p>Like all collision detection techniques, SAT has it&#8217;s pro&#8217;s and cons.  Here is a quick rundown of some of them:</p>
<p>Pros</p>
<ul>
<li>It is fast &#8211; It uses pretty basic vector math and you can bail out of a test as soon as a gap is detected, eliminating unnecessary calculations.</li>
<li>It is accurate &#8211; at least as far as I can tell.</li>
</ul>
<p>Cons</p>
<ul>
<li>It only works with Convex polygons &#8211; complex shapes are out unless you build them out of smaller convex shapes, and then test each individual shape.</li>
<li>It doesn&#8217;t tell you which sides are touching &#8211; only how far they are overlapping and the shortest distance to separate them.</li>
</ul>
<p>There is probably a bunch more but these were the main ones I could think of.</p>
<p><a name="conclusion"></a></p>
<h3>Conclusion</h3>
<p>I hope that this has helped to shed some light on the separating axis theorem.  I&#8217;ve tried to keep it as simple as possible without shedding too much information.  (I&#8217;m by no means an expert in maths so I apologise if I left anything out)</p>
<p>Here are a few links to other pages that helped me understand SAT collision detection.</p>
<ul>
<li><a href="http://www.harveycartel.org/metanet/tutorials/tutorialA.html" target="_blank">harverycartel.org</a> &#8211; more detailed descriptions and some cool interactive examples. I learnt a lot from this page.</li>
<li><a href="http://gpwiki.org/index.php/VB:Tutorials:Building_A_Physics_Engine:Basic_Intersection_Detection" target="_blank">GPWiki.org</a>- good SAT explanation and sample code &#8211; I used this as a basis for creating my own code.</li>
<li><a href="http://www.tonypa.pri.ee/vectors/index.html" target="_blank">Tony Pa</a> &#8211; Vector tutorials &#8211; Good resource for learning about Vectors</li>
<li><a href="http://www.gamedev.net/community/forums/topic.asp?topic_id=251638" target="_blank">GameDev.net forum</a> &#8211; a SAT collision system a member created &#8211; gave me some ideas on how to calculate reactions, etc.</li>
</ul>
<h3 id="download">Download:</h3>
<p>If you want to see my AS3 SAT classes you can download them here: <a href="http://www.sevenson.com.au/wp-content/plugins/download-monitor/download.php?id=3" title="Downloaded 374 times">SAT AS3 Classes</a> (They are a bit of a mess, but they work)</p>
<p>Basically, you create two shapes and then test them with the &#8216;Collision.test()&#8217; method.  If they touch then a &#8216;CollisionInfo&#8217; object will be returned. If they don&#8217;t touch then it will return &#8216;null&#8217;. The CollisionInfo object has a bunch of information about the collision that can be used to separate the two objects, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sevenson.com.au/actionscript/sat/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Reflection in ActionScript 3</title>
		<link>http://www.sevenson.com.au/actionscript/reflection/</link>
		<comments>http://www.sevenson.com.au/actionscript/reflection/#comments</comments>
		<pubDate>Sun, 24 May 2009 08:17:46 +0000</pubDate>
		<dc:creator>Andrew Sevenson</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://127.0.0.1/wordpress/?p=188</guid>
		<description><![CDATA[An ActionScript 3 class I wrote that dynamically generates reflections.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sevenson.com.au/content/uploads/2009/05/icon5.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/05/icon5.jpg" alt="" title="Reflection Icon" width="250" height="190" class="alignright size-full wp-image-572" /></a>I was creating an online gallery for a project at work when came across the need for dynamically created reflections.  We had an existing class that we usually used for reflections, but it was a bad port from AS2 to AS3 and I was never happy with it. It tended to be hard to work with and pretty inefficient.</p>
<p>In an attempt to make things better, and make my life easier in the process, I sat down and created my own Reflection class.</p>
<p>Here is what I came up with.</p>
<p><span id="more-188"></span></p>
<p>Below is a sample of the result. The moving text shows how elements fade away from the reflection point.  Also, if you click and drag in the top half of the image you will see how the reflection can update dynamically.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_swfloader_262564688"
			class="flashmovie"
			width="650"
			height="400">
	<param name="movie" value="http://www.sevenson.com.au/content/common/swfloader.swf" />
	<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/reflection/reflection.swf&amp;previewURL=http://www.sevenson.com.au/content/actionscript/reflection/preview.jpg&amp;clickToLoad=true" />
	<param name="quality" value="high" />
	<param name="wmode" value="transparent" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.sevenson.com.au/content/common/swfloader.swf"
			name="fm_swfloader_262564688"
			width="650"
			height="400">
		<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/reflection/reflection.swf&amp;previewURL=http://www.sevenson.com.au/content/actionscript/reflection/preview.jpg&amp;clickToLoad=true" />
		<param name="quality" value="high" />
		<param name="wmode" value="transparent" />
	<!--<![endif]-->
		
<div class="missingFlash">Reflection flash demo should be here</div>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>The idea behind the class is pretty simple. Basically, you create a new Reflection object and then pass it any display object that you want to reflect. Then, whenever you tell it to &#8216;refresh&#8217;, it will look at the target object, copy the bottom area, flip and fade it.</p>
<p>It uses the bounding rectangle of the target object to figure out what to reflect, but you can also override this by specifying a rectangle area to reflect.</p>
<p>You can also specify a number of different things, such as how tall you want the reflection be, how often it should refresh, and how transparent it should start and finish.</p>
<h3 id="download">Download:</h3>
<p>If you would like to check out the code for this reflection class you can do by downloading it here: <a href="http://www.sevenson.com.au/wp-content/plugins/download-monitor/download.php?id=4" title="Downloaded 185 times">Reflection Class AS3</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sevenson.com.au/actionscript/reflection/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Graph Classes written in ActionScript 3</title>
		<link>http://www.sevenson.com.au/actionscript/graph/</link>
		<comments>http://www.sevenson.com.au/actionscript/graph/#comments</comments>
		<pubDate>Sun, 24 May 2009 07:54:02 +0000</pubDate>
		<dc:creator>Andrew Sevenson</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://127.0.0.1/wordpress/?p=170</guid>
		<description><![CDATA[An experiment creating dynamic graphs using ActionScript 3.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sevenson.com.au/content/uploads/2009/05/icon6.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/05/icon6.jpg" alt="" title="Graph Classes Icon" width="250" height="190" class="alignright size-full wp-image-576" /></a>Whilst doing some work on an Mathematics Learning Object I was confronted with the problem of having to be a variety of different graphs.</p>
<p>Due to the way that these projects change over the construction period it soon became apparent that hand drawing these graphs would be too time consuming, so I set out to create some classes that could do most of the heavy lifting.</p>
<p><span id="more-170"></span></p>
<p>After a bit of planning and a lot of head scratching I finally came up with some classes that would do 95% of what I needed to do with the added bonus of being run from an external XML file structure.</p>
<p>The flash file below is an example of some of the things the classes could do.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="graph"
			class="flashmovie"
			width="650"
			height="500">
	<param name="movie" value="http://www.sevenson.com.au/content/common/swfloader.swf" />
	<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/graphAS3/graph.swf&amp;previewURL=http://www.sevenson.com.au/content/actionscript/graphAS3/preview.jpg&amp;clickToLoad=true" />
	<param name="quality" value="high" />
	<param name="wmode" value="transparent" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.sevenson.com.au/content/common/swfloader.swf"
			name="graph"
			width="650"
			height="500">
		<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/graphAS3/graph.swf&amp;previewURL=http://www.sevenson.com.au/content/actionscript/graphAS3/preview.jpg&amp;clickToLoad=true" />
		<param name="quality" value="high" />
		<param name="wmode" value="transparent" />
	<!--<![endif]-->
		
<div class="missingFlash">Flash demo should be here</div>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Without getting into the boring details it basically works like this:</p>
<ul>
<li>One class handles the grid. It draws grid lines based on the area being viewed and the physical size of the graph.</li>
<li>A second class, the Graph class, manages all of the graph elements. It acts as a parent to them all, telling them when the graph dimensions or co-ordinates change etc.</li>
<li>A base class for all of the different &#8216;graph items&#8217; acts as a common interface for all the different types of graphing elements you want to display.  Each element knows how to render itself based on current graph settings.</li>
</ul>
<p>That&#8217;s about it.  There was lots of little nuances like conditionals controlling line visibility and figuring out what numbers should appear, etc. but nothing that was hard.</p>
<p>This was one of the first things that I ever had to program in ActionScript 3 so it is a bit rough, but overall it seems to work pretty well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sevenson.com.au/actionscript/graph/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>MathML Parser written in ActionScript 3</title>
		<link>http://www.sevenson.com.au/actionscript/mathml/</link>
		<comments>http://www.sevenson.com.au/actionscript/mathml/#comments</comments>
		<pubDate>Sun, 24 May 2009 07:39:13 +0000</pubDate>
		<dc:creator>Andrew Sevenson</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[MathML]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://127.0.0.1/wordpress/?p=164</guid>
		<description><![CDATA[An experiment parsing and displaying MathML using ActionScript 3 - generating mathematical equations from XML data]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sevenson.com.au/content/uploads/2009/05/icon7.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/05/icon7.jpg" alt="" title="MathML Icon" width="250" height="190" class="alignright size-full wp-image-580" /></a>In a similar fashion to my AS3 Graphing Classes, my MathML parser was created out of necessity.  I was working on a project that had to display some equations, but drawing them out manually seemed a bit over the top.</p>
<p>I originally looked to see if anything was already available on the net but had no luck. Considering that the only other option was to create each equation manually, I decided to try and write my own MathML parser.</p>
<p><span id="more-164"></span></p>
<p>After a bit of research and playing around I came up with a set of classes that worked in a recursive manner to generate the equation.</p>
<p>The example file below demonstrates how the parser works.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="mathmlparser"
			class="flashmovie"
			width="650"
			height="350">
	<param name="movie" value="http://www.sevenson.com.au/content/common/swfloader.swf" />
	<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/mathmlAS3/mathml.swf&amp;previewURL=http://www.sevenson.com.au/content/actionscript/mathmlAS3/preview.jpg&amp;clickToLoad=true" />
	<param name="quality" value="high" />
	<param name="wmode" value="window" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.sevenson.com.au/content/common/swfloader.swf"
			name="mathmlparser"
			width="650"
			height="350">
		<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/mathmlAS3/mathml.swf&amp;previewURL=http://www.sevenson.com.au/content/actionscript/mathmlAS3/preview.jpg&amp;clickToLoad=true" />
		<param name="quality" value="high" />
		<param name="wmode" value="window" />
	<!--<![endif]-->
		
<div class="missingFlash">There should be a Flash Demo here&#8230;</div>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<h3>Download:</h3>
<p>For anyone who finds themselves in need of some MathML ActionScript classes, I have included a cleaned up version of my code for people to download here: <a href="http://www.sevenson.com.au/wp-content/plugins/download-monitor/download.php?id=5" title="Downloaded 250 times">MathML Classes</a></p>
<p>They are by no means a complete solution, but they may prove useful to someone.  Feel free to use them as you see fit, but please don&#8217;t harass me if you don&#8217;t like my code <img src='http://www.sevenson.com.au/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>On the side note, there is a program called <a href="http://www.w3.org/Amaya/">Amaya</a> that can be used to generate MathML in a pretty easy to use interface.  You can download it for free from <a href="http://www.w3.org/Amaya/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sevenson.com.au/actionscript/mathml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Text Jumbler</title>
		<link>http://www.sevenson.com.au/actionscript/textjumbler/</link>
		<comments>http://www.sevenson.com.au/actionscript/textjumbler/#comments</comments>
		<pubDate>Sun, 24 May 2009 07:29:07 +0000</pubDate>
		<dc:creator>Andrew Sevenson</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://127.0.0.1/wordpress/?p=161</guid>
		<description><![CDATA[A program that jumbles up text in a manner that is still readable.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sevenson.com.au/content/uploads/2009/05/icon8.jpg"><img src="http://www.sevenson.com.au/content/uploads/2009/05/icon8.jpg" alt="" title="Text Jumbler Icon" width="250" height="190" class="alignright size-full wp-image-582" /></a>TextJumbler is pretty useless.  It basically just jumbles up test is a particular fashion that allows the text to still be kinda readable.</p>
<p>It was based on a chain email I got a while back which explained that if all but the first and last letters of a word are jumbled up they could still be read.</p>
<p><span id="more-161"></span></p>
<p>To test it out I built this little application that jumbles up text in this manner.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="textjumbler"
			class="flashmovie"
			width="650"
			height="350">
	<param name="movie" value="http://www.sevenson.com.au/content/common/swfloader.swf" />
	<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/textjumbler/jumbler.swf&amp;previewURL=http://www.sevenson.com.au/content/actionscript/textjumbler/preview.jpg&amp;clickToLoad=true" />
	<param name="quality" value="best" />
	<param name="wmode" value="transparent" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.sevenson.com.au/content/common/swfloader.swf"
			name="textjumbler"
			width="650"
			height="350">
		<param name="flashvars" value="contentURL=http://www.sevenson.com.au/content/actionscript/textjumbler/jumbler.swf&amp;previewURL=http://www.sevenson.com.au/content/actionscript/textjumbler/preview.jpg&amp;clickToLoad=true" />
		<param name="quality" value="best" />
		<param name="wmode" value="transparent" />
	<!--<![endif]-->
		
<div class="missingFlash">There is suposed to be some flash content here</div>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>I find this application useful for annoying friends that are sticklers for spelling.</p>
<p>As a side note I did a bit of searching on the web and found  <a href="http://www.mrc-cbu.cam.ac.uk/~mattd/Cmabrigde/" target="_blank">this page</a> where the author explains where this theory started and explores the science behind it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sevenson.com.au/actionscript/textjumbler/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
