<?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>The Shady Wizard</title>
	<atom:link href="http://www.shadywizard.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shadywizard.com</link>
	<description>Bringing You Quality Gaming Content Since Like Forever</description>
	<lastBuildDate>Thu, 02 Sep 2010 03:02:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Tutorial Tuesday: Accordion Menu Using UITableViewController</title>
		<link>http://www.shadywizard.com/2010/08/tutorial-tuesday-accordion-menu-using-uitableviewcontroller/</link>
		<comments>http://www.shadywizard.com/2010/08/tutorial-tuesday-accordion-menu-using-uitableviewcontroller/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 17:04:26 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Tutorials iPhone]]></category>
		<category><![CDATA[Accordion]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[Tuesday]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[UIKit]]></category>
		<category><![CDATA[UITableView]]></category>
		<category><![CDATA[UITableViewCell]]></category>
		<category><![CDATA[UITableViewController]]></category>

		<guid isPermaLink="false">http://www.shadywizard.com/?p=652</guid>
		<description><![CDATA[I think the idea for this menu feature came to me in a dream. In all seriousness it was late at night my coffee had just worn off and I was like &#8220;HEY I can add an accordion menu!&#8221; Problem solved. My implementation is insanely simple and animated which is awesome.  So here we go. The idea [...]]]></description>
			<content:encoded><![CDATA[<p>I think the idea for this menu feature came to me in a dream. In all seriousness it was late at night my coffee had just worn off and I was like &#8220;HEY I can add an accordion menu!&#8221; Problem solved. My implementation is insanely simple and animated which is awesome.  So here we go.</p>
<p>The idea of an <a title="Wikipedia Definition" href="http://en.wikipedia.org/wiki/Accordion_(GUI)" target="_blank">accordion menu</a> is a menu with sections that are clickable and when clicked these sections expand up or down to reveal a menu item. The purpose is so you can neatly compact all your menu items into a nice small section and let them expand as needed.</p>
<p><img class="aligncenter" src="http://www.shadywizard.com/wp-content/uploads/2010/08/PianoAccordeon.jpg" alt="" width="298" height="250" /></p>
<p>This idea of menu items and them being clickable and expanding and moving and reacting to one another fits perfectly with in a UITableViewController. So that is where we will start first make a UITableViewController like so:</p>
<p><span id="more-652"></span></p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import</span><br />
<span style="color: #6e371a;">#import &quot;AccordionSelectorCell.h&quot;</span><br />
<span style="color: #6e371a;">#import &quot;AccordionDataCell.h&quot;</span><br />
<br />
<span style="color: #a61390;">@interface</span> AccordionTableViewController <span style="color: #002200;">:</span> UITableViewController <span style="color: #002200;">&#123;</span><br />
<span style="color: #a61390;">int</span> numRowSelected;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>Here we are making a table view that has one section and twelve cells, the number of cells should be even to allow for half menu selectors and half being menu data. Each odd numbered cell is being made a DataCell so those cells will be filled with the content of your menu item. The even cells are being made SelectorCell so these will be the menu items that are clicked that correspond to a DataCell.</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#pragma mark -</span><br />
<span style="color: #6e371a;">#pragma mark Table view data source</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>numberOfSectionsInTableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView <span style="color: #002200;">&#123;</span><br />
<span style="color: #11740a; font-style: italic;">// Return the number of sections.</span><br />
<span style="color: #a61390;">return</span> <span style="color: #2400d9;">1</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>tableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView numberOfRowsInSection<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>section <span style="color: #002200;">&#123;</span><br />
<span style="color: #11740a; font-style: italic;">// Return the number of rows in the section.</span><br />
<span style="color: #a61390;">return</span> <span style="color: #2400d9;">12</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #11740a; font-style: italic;">// Customize the appearance of table view cells.</span><br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>UITableViewCell <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView cellForRowAtIndexPath<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span style="color: #400080;">NSIndexPath</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>indexPath <span style="color: #002200;">&#123;</span><br />
<br />
<span style="color: #a61390;">static</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>CellIdentifier <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Cell&quot;</span>;<br />
<br />
UITableViewCell <span style="color: #002200;">*</span>cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>tableView dequeueReusableCellWithIdentifier<span style="color: #002200;">:</span>CellIdentifier<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>cell <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span><br />
<br />
<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>indexPath.row <span style="color: #002200;">!=</span> <span style="color: #2400d9;">0</span> <span style="color: #002200;">&amp;</span>amp;<span style="color: #002200;">&amp;</span>amp; <span style="color: #002200;">&#40;</span>indexPath.row <span style="color: #002200;">-</span> <span style="color: #2400d9;">1</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">%</span> <span style="color: #2400d9;">2</span> <span style="color: #002200;">==</span> <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span><br />
<span style="color: #002200;">&#123;</span><br />
cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>TowerInfoDataCell alloc<span style="color: #002200;">&#93;</span> initWithStyle<span style="color: #002200;">:</span>UITableViewCellStyleDefault reuseIdentifier<span style="color: #002200;">:</span>CellIdentifier<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<span style="color: #a61390;">else</span><br />
<span style="color: #002200;">&#123;</span><br />
cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>TowerInfoSelectorCell alloc<span style="color: #002200;">&#93;</span> initWithStyle<span style="color: #002200;">:</span>UITableViewCellStyleDefault reuseIdentifier<span style="color: #002200;">:</span>CellIdentifier<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;<br />
cell.textLabel.text <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Upgrade Name&quot;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #11740a; font-style: italic;">// Configure the cell...</span><br />
<br />
<span style="color: #a61390;">return</span> cell;<br />
<span style="color: #002200;">&#125;</span></div></td></tr></tbody></table></div>
<p>In the table view&#8217; s delegate is where the magic happens. in using the selected row we change the numRowSelected to the menu item that is one row beyond it if you want menu items to be titled from the bottom just change the &#8220;+&#8221; to a &#8220;-&#8221;. Also the use of [beginUpdates] and [endUpdates] will cause the table to animate the change in height of the cells.</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#pragma mark -</span><br />
<span style="color: #6e371a;">#pragma mark Table view delegate</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>tableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView didSelectRowAtIndexPath<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span style="color: #400080;">NSIndexPath</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>indexPath <span style="color: #002200;">&#123;</span><br />
<span style="color: #11740a; font-style: italic;">// Navigation logic may go here. Create and push another view controller.</span><br />
<span style="color: #11740a; font-style: italic;">/*<br />
To conform to the Human Interface Guidelines, selections should not be persistent --<br />
deselect the row after it has been selected.<br />
*/</span><br />
<span style="color: #002200;">&#91;</span>tableView deselectRowAtIndexPath<span style="color: #002200;">:</span>indexPath animated<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
<br />
<span style="color: #11740a; font-style: italic;">// Main logic for selecting of the cell and it's corresponding dataCell</span><br />
<span style="color: #002200;">&#91;</span>tableView beginUpdates<span style="color: #002200;">&#93;</span>;<br />
numRowSelected <span style="color: #002200;">=</span> indexPath.row <span style="color: #002200;">+</span> <span style="color: #2400d9;">1</span>;<br />
<span style="color: #002200;">&#91;</span>tableView endUpdates<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>CGFloat<span style="color: #002200;">&#41;</span>tableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView heightForRowAtIndexPath<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span style="color: #400080;">NSIndexPath</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>indexPath<br />
<span style="color: #002200;">&#123;</span><br />
<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>indexPath.row <span style="color: #002200;">==</span> numRowSelected<span style="color: #002200;">&#41;</span><br />
<span style="color: #a61390;">return</span> <span style="color: #2400d9;">100.0</span>; <span style="color: #11740a; font-style: italic;">//returns floating point which will be used for a cell row height at specified row index</span><br />
<span style="color: #a61390;">else</span> <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>indexPath.row <span style="color: #002200;">-</span> <span style="color: #2400d9;">1</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">%</span> <span style="color: #2400d9;">2</span> <span style="color: #002200;">==</span> <span style="color: #2400d9;">0</span> || numRowSelected <span style="color: #002200;">&amp;</span>lt; <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span><br />
<span style="color: #002200;">&#123;</span><br />
<span style="color: #a61390;">return</span> 0.0f; <span style="color: #11740a; font-style: italic;">//returns floating point which will be used for a cell row height at specified row index</span><br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">return</span> 15.0f; <span style="color: #11740a; font-style: italic;">//returns floating point which will be used for a cell row height at specified row index</span><br />
<span style="color: #002200;">&#125;</span></div></td></tr></tbody></table></div>
<p>in the viewDidLoad I am initializing which row should start selected and adding a special case if no menu items should appear.</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#pragma mark -</span><br />
<span style="color: #6e371a;">#pragma mark View lifecycle</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewDidLoad <span style="color: #002200;">&#123;</span><br />
<span style="color: #002200;">&#91;</span>super viewDidLoad<span style="color: #002200;">&#93;</span>;<br />
<br />
<span style="color: #11740a; font-style: italic;">// The first menuItem to be opened on load or make this -1 to have zero menuItems appear open</span><br />
numRowSelected <span style="color: #002200;">=</span> <span style="color: #2400d9;">1</span>;<br />
<span style="color: #002200;">&#125;</span></div></td></tr></tbody></table></div>
<p>Now in the TableViewCells just set up each view how you want it to look. Also making the selectionStyle of the DataCell equal UITableViewCellSelectionStyleNone is rather important.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shadywizard.com/2010/08/tutorial-tuesday-accordion-menu-using-uitableviewcontroller/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial Tuesday : AS3 Bad Word Filter</title>
		<link>http://www.shadywizard.com/2010/08/tutorial-tuesday-as3-bad-word-filter/</link>
		<comments>http://www.shadywizard.com/2010/08/tutorial-tuesday-as3-bad-word-filter/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 05:50:54 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Tutorials Flash]]></category>
		<category><![CDATA[3.0]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[bad]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flashdevelop]]></category>
		<category><![CDATA[profanity]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[word]]></category>

		<guid isPermaLink="false">http://www.shadywizard.com/?p=634</guid>
		<description><![CDATA[If you ever need to filter bad words in your Flash programs, it&#8217;s a simple task. Thanks to the String class in Actionscript 3.0, its &#8220;search&#8221; function packs this solution into only a few lines of code. There are several ways to go about this, but for this example we&#8217;ll put any bad words we [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever need to filter bad words in your Flash programs, it&#8217;s a simple task. Thanks to the String class in Actionscript 3.0, its &#8220;search&#8221; function packs this solution into only a few lines of code.<br />
<span id="more-634"></span><br />
There are several ways to go about this, but for this example we&#8217;ll put any bad words we want to filter into an array. Here I am just adding a few fake profanities for testing purposes, but you&#8217;ll need to add a lot of offensive words to have a complete filter list.</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> badWords<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; badWords = <span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;poop&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;pee&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;doodoo&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>
<p>Whenever you need to test if a String contains any profanities, we&#8217;ll just pass it into our custom filterWord function. The function checks each bad word in our list to see if it is within our tested String. If we don&#8217;t find it, the search function returns -1. If a bad word is found, the search function returns the index of where it was found. *NOTE* We&#8217;re converting the String to lowercase before testing it, just to make sure the profanity filter doesn&#8217;t have to deal with any combination of capital letters.</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> filterWord<span style="color: #000000;">&#40;</span>word<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"><span style="color: #004993;">Boolean</span></a><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = word<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">toLowerCase</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span>i = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> badWords<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>word<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">search</span><span style="color: #000000;">&#40;</span>badWords<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">!</span>= <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">//we found profanity!</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">//these aren't the droids we're looking for, move along</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>
<p>I wrote a quick program that demonstrates this bad word filter, and I&#8217;ll post the code and swf below.</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #9900cc; font-weight: bold;">package</span> <br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000;">&#91;</span>SWF<span style="color: #000000;">&#40;</span><span style="color: #004993;">width</span> = <span style="color: #990000;">&quot;300&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">height</span> = <span style="color: #990000;">&quot;300&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">backgroundColor</span> = <span style="color: #990000;">&quot;#000000&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span> &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Main <span style="color: #0033ff; font-weight: bold;">extends</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a> <br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> badWords<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> tf<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> filterText<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> format<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span style="color: #004993;">TextFormat</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; badWords = <span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;poop&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;pee&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;doodoo&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> format<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;arial&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">14</span><span style="color: #000066; font-weight: bold;">,</span> 0x000000<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; format<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">align</span> = <span style="color: #990000;">&quot;center&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tf = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">defaultTextFormat</span> = format<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">background</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">type</span> = <a href="http://www.google.com/search?q=textfieldtype%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfieldtype.html"><span style="color: #004993;">TextFieldType</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">INPUT</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span> = <span style="color: #000000; font-weight:bold;">300</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> = <span style="color: #000000; font-weight:bold;">20</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000;">&#40;</span><span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageHeight</span> <span style="color: #009966; font-style: italic;">/ 2) - (tf.height /</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Click Here and Type Something&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>tf<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; format<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">color</span> = 0xffffff<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filterText = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filterText<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">defaultTextFormat</span> = format<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filterText<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span> = <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageWidth</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filterText<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000066; font-weight: bold;">+</span> tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>filterText<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> handleTextClick<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span> updateFilter<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> filterWord<span style="color: #000000;">&#40;</span>word<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"><span style="color: #004993;">Boolean</span></a><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = word<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">toLowerCase</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span>i = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> badWords<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>word<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">search</span><span style="color: #000000;">&#40;</span>badWords<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">!</span>= <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> updateFilter<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>filterWord<span style="color: #000000;">&#40;</span>tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filterText<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;BAD WORD!&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filterText<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;No naughty words detected&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handleTextClick<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tf<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>
<p>Any user input containing our buzzer words(poop, pee, doodoo) will be detected immediately.</p>
<p style="padding-left: 210px;">
<object /><br />
<embed type="application/x-shockwave-flash" width="300" height="300" src="http://www.shadywizard.com/wp-content/uploads/2010/09/TutTuesday2.swf"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shadywizard.com/2010/08/tutorial-tuesday-as3-bad-word-filter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial Tuesday: UIKit With Interface Builder for User Interfaces and Orientation</title>
		<link>http://www.shadywizard.com/2010/08/tutorial-tuesday-uikit-with-interface-builder-for-user-interfaces-and-orientation/</link>
		<comments>http://www.shadywizard.com/2010/08/tutorial-tuesday-uikit-with-interface-builder-for-user-interfaces-and-orientation/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 21:49:38 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Tutorials iPhone]]></category>
		<category><![CDATA[.xib]]></category>
		<category><![CDATA[EAGLView]]></category>
		<category><![CDATA[Interface Builder]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[NIB]]></category>
		<category><![CDATA[Orientation]]></category>
		<category><![CDATA[Tuesday Tutorial]]></category>
		<category><![CDATA[UIDevice]]></category>
		<category><![CDATA[UIDeviceOrientatioin]]></category>
		<category><![CDATA[UIIterfaceOrientation]]></category>
		<category><![CDATA[UIKit]]></category>
		<category><![CDATA[UIViewController]]></category>

		<guid isPermaLink="false">http://www.shadywizard.com/?p=506</guid>
		<description><![CDATA[After watching the WWDC 2010 Session video called Game Design and Development for the iPhone OS I was really inspired to integrate UIKit into my openGL projects. The plan is to make .xib files with Interface Builder and load them into my openGL project with the right orientation and a little functionality. The top level [...]]]></description>
			<content:encoded><![CDATA[<p>After watching the WWDC 2010 Session video called Game Design and Development for the iPhone OS I was really inspired to integrate UIKit into my openGL projects. The plan is to make .xib files with Interface Builder and load them into my openGL project with the right orientation and a little functionality.</p>
<p><img class="aligncenter size-full wp-image-630" title="IB-SS" src="http://www.shadywizard.com/wp-content/uploads/2010/08/IB-SS.png" alt="IB-SS" width="148" height="102" /></p>
<p><span id="more-506"></span></p>
<p>The top level view will be my EAGLView, which will contain all my subviews, which for this tutorial will be a heads-up-display(HUD) that appears when a tile is selected. My first task was getting my UIViewController setup with an associated .xib file. The file <strong>wizard</strong> will create a file in your project named whatever you-name -it and it will create a (samename).xib file that will be connected to that UIViewController.</p>
<p><img class="aligncenter size-medium wp-image-584" title="UIViewController-First-Step" src="http://www.shadywizard.com/wp-content/uploads/2010/08/UIViewController-First-Step-300x229.png" alt="UIViewController-First-Step" width="300" height="229" /></p>
<p>Once the UIViewController file is made we can setup any IBOutlet objects you will need, for my example I will need three buttons: FireButton(btnFire), PlantButton(btnPlant), and  WindButton(btnWind).</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #a61390;">@interface</span> UItower <span style="color: #002200;">:</span> UIViewController<br />
<span style="color: #002200;">&#123;</span><br />
IBOutlet UIButton <span style="color: #002200;">*</span> btnFire;<br />
IBOutlet UIButton <span style="color: #002200;">*</span> btnPlant;<br />
IBOutlet UIButton <span style="color: #002200;">*</span> btnWind;<br />
<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UIButton <span style="color: #002200;">*</span> btnFire;<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UIButton <span style="color: #002200;">*</span> btnPlant;<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UIButton <span style="color: #002200;">*</span> btnWind;<br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>Double clicking on the .xib file will open it in Interface Builder. You will notice that the file <strong>wizard</strong> has hooked up a few things for us in Interface Builder.</p>
<p><img class="size-large wp-image-591" title="IB-step-Three" src="http://www.shadywizard.com/wp-content/uploads/2010/08/IB-step-Three-1024x316.png" alt="IB-step-Three" width="738" height="227" /><br />
The next step will be connecting the UIButtons to UIButtons that we make in Interface Builder. Drag a few UIButtons onto the View window and position them how you want. For this project I need the orintation to be Landscape mode so you can change the view window to landscape mode by clicking the rotated arrow button in the top right corner of the view window.<br />
<img class="alignleft size-large wp-image-599" title="IB-step-4" src="http://www.shadywizard.com/wp-content/uploads/2010/08/IB-step-4-1024x326.png" alt="IB-step-4" width="744" height="236" /><br />
With your UIButtons positioned in your view and with any little customizations you need added to them; all you will need to do is connect the IBOutlet Buttons in the file owner to the UIButtons currently positioned in the view. Do this by clicking and dragging from the little circle beside the button in the connection window and hooking it to the button it corresponds too. Now save your .xib file and your done with half of the work.</p>
<p>Now that we have a .xib file all setup with good data we need to load it into the game and use it. For my case I am going to load my instance of the UIViewController I named &#8220;UItower&#8221; into my class called &#8220;TowerButtonSelected&#8221; and I will be initialing this &#8220;UItower&#8221; in my &#8220;initWithView&#8221; method. The interface will look like so:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import</span><br />
<br />
<span style="color: #a61390;">@class</span> EAGLView;<br />
<span style="color: #a61390;">@class</span> UItower;<br />
<br />
<span style="color: #a61390;">@interface</span> TowerButtonSelected <span style="color: #002200;">:</span> ButtonTypeSelected <span style="color: #002200;">&#123;</span><br />
UItower <span style="color: #002200;">*</span> contextMenu;<br />
<span style="color: #002200;">&#125;</span><br />
<span style="color: #002200;">-</span>initWithView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>EAGLView<span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>glView;<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>The &#8220;initWithView&#8221; will be defined as:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">-</span>initWithView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>EAGLView<span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>glView<br />
<span style="color: #002200;">&#123;</span><br />
<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self init<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span><br />
<span style="color: #002200;">&#123;</span><br />
contextMenu <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UItower alloc<span style="color: #002200;">&#93;</span> initWithNibName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;UItower&quot;</span><br />
bundle<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span style="color: #400080;">NSBundle</span></a> mainBundle<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#91;</span>glView addSubview<span style="color: #002200;">:</span>contextMenu.view<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<span style="color: #a61390;">return</span> self;<br />
<span style="color: #002200;">&#125;</span></div></td></tr></tbody></table></div>
<p>I am using &#8220;initWithNibName&#8221; passing the .xib file name as my first param and the main Bundle as my second. The second param should be whichever Bundle you have your .xib file in. Then I just add the contextMenu&#8217;s view into the subview of EAGLView which I passed in from my MainGame class.</p>
<p><img class="aligncenter size-full wp-image-603" title="GameSS-BadRotation" src="http://www.shadywizard.com/wp-content/uploads/2010/08/GameSS-BadRotation.png" alt="GameSS-BadRotation" width="710" height="368" /></p>
<p>Unfortunately the .xib file doesn&#8217;t tell the UIViewController that my Device is in Landscape mode so my interface is rotated in a bad way. To solve this you can overwrite &#8220;shouldAutorotateToInterfaceOrientation &#8221; but that is an uncomfortable solution because the Interface is still loaded wrong and only after a message has been sent to the UIViewController will it orientate itself. The best solution I have found is to overwrite a UIViewController and just rotate the view in that class&#8217;s &#8220;viewDidLoad&#8221; then just derive off that UIViewController for the views that you want loaded in Landscape mode. For example:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import</span><br />
<span style="color: #a61390;">@interface</span> LandscapeUIViewController <span style="color: #002200;">:</span> UIViewController <span style="color: #002200;">&#123;</span><br />
<br />
<span style="color: #002200;">&#125;</span><br />
<span style="color: #a61390;">@end</span><br />
<br />
<span style="color: #a61390;">@implementation</span> LandscapeUIViewController<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewDidLoad <span style="color: #002200;">&#123;</span><br />
<span style="color: #002200;">&#91;</span>super viewDidLoad<span style="color: #002200;">&#93;</span>;<br />
self.view.center <span style="color: #002200;">=</span> CGPointMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">160</span>, <span style="color: #2400d9;">240</span><span style="color: #002200;">&#41;</span>;<br />
self.view.transform <span style="color: #002200;">=</span> CGAffineTransformMakeRotation<span style="color: #002200;">&#40;</span>degreesToRadian<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">90</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>Note that you will need to center the view <strong>and</strong> also rotate but that is mostly because we are dealing with a flipped X and Y direction because of the Portrait mode nonsense. So now we just derive UItower off of LandscapeUIViewController and your view will load properly in LandscapeRight mode.</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #a61390;">@interface</span> UItower <span style="color: #002200;">:</span> LandscapeUIViewController</div></td></tr></tbody></table></div>
<p>Now for your application to orinate properly based on the Device&#8217;s orientation you just have to move the EAGLView based on the UIDeviceOrientaion. For that I simple added a few lines in the delegate. Make sure to call</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIDevice currentDevice<span style="color: #002200;">&#93;</span> beginGeneratingDeviceOrientationNotifications<span style="color: #002200;">&#93;</span>;</div></td></tr></tbody></table></div>
<p>Then add an observer for the &#8220;UIDeviceOrientationDidChangeNotification&#8221; like so:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/"><span style="color: #400080;">NSNotificationCenter</span></a> defaultCenter<span style="color: #002200;">&#93;</span> addObserver<span style="color: #002200;">:</span>self<br />
selector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>didRotate<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><br />
name<span style="color: #002200;">:</span>UIDeviceOrientationDidChangeNotification<br />
object<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;</div></td></tr></tbody></table></div>
<p>For my specific project I wanted only Landscape mode available so my &#8220;didRotate&#8221; function looks like this:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>didRotate<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNotification_Class/"><span style="color: #400080;">NSNotification</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>notification<br />
<span style="color: #002200;">&#123;</span><br />
UIDeviceOrientation orientation <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIDevice currentDevice<span style="color: #002200;">&#93;</span> orientation<span style="color: #002200;">&#93;</span>;<br />
<br />
<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>orientation <span style="color: #002200;">==</span> UIDeviceOrientationLandscapeLeft<span style="color: #002200;">&#41;</span><br />
<span style="color: #002200;">&#123;</span><br />
glView.transform <span style="color: #002200;">=</span> CGAffineTransformMakeRotation<span style="color: #002200;">&#40;</span>degreesToRadian<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<span style="color: #a61390;">else</span> <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>orientation <span style="color: #002200;">==</span> UIDeviceOrientationLandscapeRight<span style="color: #002200;">&#41;</span><br />
<span style="color: #002200;">&#123;</span><br />
glView.transform <span style="color: #002200;">=</span> CGAffineTransformMakeRotation<span style="color: #002200;">&#40;</span>degreesToRadian<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">180</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<span style="color: #002200;">&#125;</span></div></td></tr></tbody></table></div>
<p>You can add animations instead of just changing the transforms to make a nice transition from one orientation to the next if you like.</p>
<p><img class="aligncenter size-full wp-image-619" title="GameSS-GoodRotation" src="http://www.shadywizard.com/wp-content/uploads/2010/08/GameSS-GoodRotation.png" alt="GameSS-GoodRotation" width="715" height="375" /></p>
<p>Now our app will orientate for LandscapeLeft and LandscapeRight and the UIViewController we loaded in will be loaded with the LandscapeRight orientation that we wanted.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shadywizard.com/2010/08/tutorial-tuesday-uikit-with-interface-builder-for-user-interfaces-and-orientation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kicking off Tutorial Tuesday</title>
		<link>http://www.shadywizard.com/2010/08/kicking-off-tutorial-tuesday/</link>
		<comments>http://www.shadywizard.com/2010/08/kicking-off-tutorial-tuesday/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 06:56:53 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Tutorials Flash]]></category>
		<category><![CDATA[3]]></category>
		<category><![CDATA[3.0]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[blurfilter]]></category>
		<category><![CDATA[colormatrixfilter]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flashdevelop]]></category>
		<category><![CDATA[glowfilter]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.shadywizard.com/?p=508</guid>
		<description><![CDATA[We decided to start posting some useful Flash/iPhone tutorials on tuesdays, so I&#8217;m starting with a pretty simple demonstration of some of the neat easy-to-use filters in Actionscript 3.0 : GlowFilter, BlurFilter, and ColorMatrixFilter. They all have their uses, and they can help you make some neat effects without needing an artist in your pocket. [...]]]></description>
			<content:encoded><![CDATA[<p>We decided to start posting some useful Flash/iPhone tutorials on tuesdays, so I&#8217;m starting with a pretty simple demonstration of some of the neat easy-to-use filters in Actionscript 3.0 : GlowFilter, BlurFilter, and ColorMatrixFilter. They all have their uses, and they can help you make some neat effects without needing an artist in your pocket.<br />
<span id="more-508"></span></p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #9900cc; font-weight: bold;">package</span> <br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.filters</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000;">&#91;</span>SWF<span style="color: #000000;">&#40;</span><span style="color: #004993;">width</span> = <span style="color: #990000;">&quot;300&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">height</span> = <span style="color: #990000;">&quot;300&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">backgroundColor</span> = <span style="color: #990000;">&quot;#000000&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span> &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Main <span style="color: #0033ff; font-weight: bold;">extends</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a> <br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> box<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> blur<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> boxData<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=bitmapdata%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bitmapdata.html"><span style="color: #004993;">BitmapData</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=bitmapdata%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bitmapdata.html"><span style="color: #004993;">BitmapData</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">40</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">40</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">,</span> 0xffffff<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> boxBitmap<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=bitmap%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bitmap.html"><span style="color: #004993;">Bitmap</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=bitmap%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bitmap.html"><span style="color: #004993;">Bitmap</span></a><span style="color: #000000;">&#40;</span>boxData<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>boxBitmap<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000;">&#40;</span><span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageWidth</span> <span style="color: #009966; font-style: italic;">/ 2) - (box.width /</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000;">&#40;</span><span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageHeight</span> <span style="color: #009966; font-style: italic;">/ 2) - (box.height /</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_OVER</span><span style="color: #000066; font-weight: bold;">,</span> handleMouseOver<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_OUT</span><span style="color: #000066; font-weight: bold;">,</span> handleMouseOut<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> handleMouseClick<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handleMouseOver<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">filters</span> = <span style="color: #000000;">&#91;</span><span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=glowfilter%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:glowfilter.html"><span style="color: #004993;">GlowFilter</span></a><span style="color: #000000;">&#40;</span>0xffffff<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">16</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">16</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handleMouseOut<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">matrix</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">matrix</span> = <span style="color: #004993;">matrix</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">concat</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">matrix</span> = <span style="color: #004993;">matrix</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">concat</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">matrix</span> = <span style="color: #004993;">matrix</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">concat</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">matrix</span> = <span style="color: #004993;">matrix</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">concat</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">filters</span> = <span style="color: #000000;">&#91;</span><span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=colormatrixfilter%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:colormatrixfilter.html"><span style="color: #004993;">ColorMatrixFilter</span></a><span style="color: #000000;">&#40;</span><span style="color: #004993;">matrix</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blur = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handleMouseClick<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blur <span style="color: #000066; font-weight: bold;">+</span>=<span style="color: #000000; font-weight:bold;">2</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">filters</span> = <span style="color: #000000;">&#91;</span><span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=blurfilter%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:blurfilter.html"><span style="color: #004993;">BlurFilter</span></a><span style="color: #000000;">&#40;</span>blur<span style="color: #000066; font-weight: bold;">,</span> blur<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>
<p><strong>Lines 3-5</strong>: import our libraries. The filters libraries are required to use these effects.<br />
<strong>Lines 10-11</strong>: We&#8217;re declaring a few variables here. We&#8217;re going to apply our filters to the &#8220;box&#8221; sprite, and the blur number will help us keep track of how blurry to make our BlurFilter.<br />
<strong>Lines 15-22</strong>: Here we&#8217;re just setting up our box sprite. We&#8217;re drawing a 40&#215;40 white bitmap and adding it to the box sprite. Then we&#8217;re adding the sprite to our stage.<br />
<strong>Lines 24-26</strong>: Adding mouse event listeners to the sprite. We&#8217;ll want to apply different filters on hovering over the box, hovering out of the box, and clicking the box.</p>
<p>On to the actual filter effects!</p>
<p><strong>Line 30</strong>: This is the GlowFilter- just a 1 liner. There are several settings that can be passed in here:<br />
color : color of the glow<br />
alpha : transparency of the glow<br />
blurX and blurY : how far out the glow should extend<br />
strength : the intensity of the glow<br />
quality : How good the glow looks &#8212; this parameter greatly effects the performance of the filter, but the default quality of 1 gives a really crappy glow effect. Unfortunately, tons of cranked up quality GlowFilters will bog things down.<br />
inner : true or false, should the glow be on the inside or outside of the object?<br />
knockout : true or false, the knockout effect punches out the object of the glowfilter, sort of like an eclipse.</p>
<p><strong>Lines 34-39</strong>: The ColorMatrixFilter looks pretty intimidating, but using the basics of it is pretty simple. It takes in only a matrix i.e. array. The 3 random values you see there represent the red, blue, and green values, while the 1 is the alpha. so if you want to make something look more blue, you just pass in low values for the red/green and a high value for the blue.</p>
<p><strong>Lines 45-46</strong>: the BlurFilter. All we&#8217;re doing here is adding a blur when the box is clicked. Each time the box is clicked we&#8217;re increasing the blurX and blurY and reapplying the filter. The quality setting is similar to the quality setting in the GlowFilter. It will definitely slow down your program if you use too many filters with high quality settings!</p>
<p style="padding-left: 210px;">
<object /><br />
<embed type="application/x-shockwave-flash" width="300" height="300" src="http://www.shadywizard.com/wp-content/uploads/2010/08/TutTuesday1.swf"></embed></object>
</p>
<p>And this is the finished product. Hovering over the box makes it glow, clicking on the box makes it blurry, and hovering out of the box gives it a random color.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shadywizard.com/2010/08/kicking-off-tutorial-tuesday/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In Retrospect: A Psychosis Tale</title>
		<link>http://www.shadywizard.com/2010/03/in-retrospect-a-psychosis-tale/</link>
		<comments>http://www.shadywizard.com/2010/03/in-retrospect-a-psychosis-tale/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 17:20:40 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Opinion]]></category>
		<category><![CDATA[advice]]></category>
		<category><![CDATA[developers]]></category>
		<category><![CDATA[Full Sail University]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[marketing]]></category>
		<category><![CDATA[Psychosis Studio]]></category>
		<category><![CDATA[Seattle]]></category>
		<category><![CDATA[TouchArcade]]></category>

		<guid isPermaLink="false">http://www.shadywizard.com/?p=390</guid>
		<description><![CDATA[For about a year right after I graduated from Full Sail, a friend and I moved to Seattle and started an iPhone studio named &#8220;Psychosis Studio&#8221;. During my time at Psychosis Studio I was privy to all the data that surrounded the sales and success of all the apps that were released. So I got [...]]]></description>
			<content:encoded><![CDATA[<p>For about a year right after I graduated from Full Sail, a friend and I moved to Seattle and started an iPhone studio named &#8220;Psychosis Studio&#8221;. During my time at Psychosis Studio I was privy to all the data that surrounded the sales and success of all the apps that were released. So I got to see first hand what just a little bit of &#8220;press&#8221; and marketing can do for a small struggling iPhone developer.<br />
<img class="aligncenter size-full wp-image-491" title="Psychosis300x300" src="http://www.shadywizard.com/wp-content/uploads/2010/03/Psychosis300x300.png" alt="Psychosis300x300" width="300" height="300" /> <span id="more-390"></span><br />
<strong>OUR STRATEGY </strong></p>
<p>The general idea at Psychosis when it came to marketing was: &#8220;tell our friends&#8221;,  &#8220;tell Touch Arcade&#8221; and &#8220;pray we get featured&#8221;. That was the extent that marketing was a priority. In fact we did get on a featured list at one point under the &#8220;Hot New Games&#8221; but we struggled to even get above last place on that list for our game Parking Panic. We used facebook and a little of twitter but being code monkeys our social skills were lacking to say the least, which is a bad thing for <strong>social </strong>media.</p>
<p><strong>A GAME WITHOUT MARKETING</strong></p>
<p>Our first game at Psychosis was a simple little puzzle game with a hundred levels and sliding tiles called &#8220;Turtle Soup&#8221;. In general Turtle Soup was a failure we barely sold one hundred copies our first day and over all the game was seen as big expenditure of time without a good pay out. The only good thing that did come from Turtle Soup was we had learned a lot about what doesn&#8217;t work. With Turtle Soup the idea was to release the game, pray it got featured, and then hope that would carry us to the top (so a lot of wishful thinking). With no exposure other than being on the &#8220;release date&#8221; we had no chance of selling enough to place anywhere in the top paid of our category.</p>
<ul>
<li>First week sales: $126</li>
<li>Average first month daily sales: $10</li>
</ul>
<p><strong>A GAME WITH A LITTLE MARKETING</strong></p>
<p>Shortly after Turtle Soup we started development of a game we released called &#8220;Tunnel Vision&#8221;. With this game we employed our marketing strategy and the results were surprising compared to Turtle Soup. I would deem Tunnel Vision a success as far as what we could expect from the amount of actual marketing we did do. The game sold well over three hundred copies the first day and continued its good sales numbers up until the end of the app&#8217;s lifetime. For about four months after the release we maintained sales of about two to three hundred per week.  Valuing it based on time spent on the game it was very profitable with one programmer and one artist the game was developed tested and released in about six weeks.</p>
<ul>
<li>First week sales: $1965</li>
<li>Average first month daily sales: $133</li>
</ul>
<p><strong>CONCLUSION</strong></p>
<p>In the end the general flaw with what we were doing with the games was not doing enough of what works. We really needed to &#8220;push&#8221; our games more because that is really what generates sales. If we were to do the whole thing again I think bringing in someone that is skilled at getting buzz and talking about projects would have been a good thing to do. Getting a hybrid team member (something/marketer) would have been a huge boon to the company and the sales of the games. What this has taught me is that I personally need to work harder at being that hybrid person, because even a little shove can make a game sell ten times better.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shadywizard.com/2010/03/in-retrospect-a-psychosis-tale/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>China, oh China</title>
		<link>http://www.shadywizard.com/2010/02/china-oh-china/</link>
		<comments>http://www.shadywizard.com/2010/02/china-oh-china/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 04:36:02 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://www.shadywizard.com/?p=475</guid>
		<description><![CDATA[The Great Poop Shoot has been around for a little while now, and it&#8217;s been played over 40,000 times!  That&#8217;s not a very high amount of plays by any means, but I thought it was quite interesting how many of those plays were from China. Is China the potty humor capital of the world!? I [...]]]></description>
			<content:encoded><![CDATA[<p><em>The Great Poop Shoot</em> has been around for a little while now, and it&#8217;s been played over 40,000 times!  That&#8217;s not a very high amount of plays by any means, but I thought it was quite interesting how many of those plays were from China.</p>
<p><img class="aligncenter size-full wp-image-476" title="pooanalytics" src="http://www.shadywizard.com/wp-content/uploads/2010/02/pooanalytics.png" alt="pooanalytics" width="415" height="193" /></p>
<p>Is China the potty humor capital of the world!? I highly doubt it, but it seems <em>The Great Poop Shoot</em> found its way to a popular Chinese site &#8220;7k7k.com&#8221; and hopefully gave all of those Chinese people a chuckle.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shadywizard.com/2010/02/china-oh-china/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This Ain&#8217;t No Fool</title>
		<link>http://www.shadywizard.com/2010/02/this-aint-no-fool/</link>
		<comments>http://www.shadywizard.com/2010/02/this-aint-no-fool/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 16:07:16 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://www.shadywizard.com/?p=466</guid>
		<description><![CDATA[I&#8217;ve been a fan of the Metal Slug pixel art for some time now, but those games are old old news. If you really want to check it out and get spammed with ads, someone over at MetalSlugSprites.net has ripped a ton of images and animations from the game(more than likely illegally). It&#8217;s worth a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a fan of the Metal Slug pixel art for some time now, but those games are old old news. If you really want to check it out and get spammed with ads, someone over at <a href="http://www.metalslugsprites.net/">MetalSlugSprites.net</a> has ripped a ton of images and animations from the game(more than likely illegally). It&#8217;s worth a look for study purposes, but please don&#8217;t use them for your games.</p>
<p>Metal Slug, I&#8217;ma let you finish, but&#8230; the other day I stumbled on a guy named Yuriy Gusev, whose art left me completely stunned. He goes by the alias &#8220;Fool&#8221; on some websites, including <a href="http://www.pixeljoint.com/">Pixel Joint</a>. He runs his own website, <a href="http://foolstown.com/">Foolstown</a>, which is a delightful experience in itself.<br />
<img src="http://www.shadywizard.com/wp-content/uploads/2010/02/chars1.png" alt="chars1" title="chars1" width="320" height="80" class="aligncenter size-full wp-image-467" /></p>
<p>I originally came across a few of his characters and immediately had an interest in his style. But his scenes and animations are what really take the cake and qualify Yuriy as one of my favorite pixel artists of all time. How can <a href="http://www.foolstown.com/gallery/index.php/scenes/">this</a> not make you weak in the knees?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shadywizard.com/2010/02/this-aint-no-fool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Joys of Distribution</title>
		<link>http://www.shadywizard.com/2010/02/the-joys-of-distribution/</link>
		<comments>http://www.shadywizard.com/2010/02/the-joys-of-distribution/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 15:24:19 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Game News]]></category>

		<guid isPermaLink="false">http://www.shadywizard.com/?p=462</guid>
		<description><![CDATA[Yesterday I spent a few hours working on distributing my game to various portals on the interwebs. This is a surprisingly daunting task, especially if you&#8217;re doing it all manually. Each portal has a different submission process, but most of them want you to register. Expect to fill out a decent of information about yourself [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I spent a few hours working on distributing my game to various portals on the interwebs. This is a surprisingly daunting task, especially if you&#8217;re doing it all manually. Each portal has a different submission process, but most of them want you to register. Expect to fill out a decent of information about yourself and your game before moving on to the next flash arcade.<br />
<span id="more-462"></span><br />
There are over 100 sites to submit games <a href="http://wiki.mochimedia.com/Flash-Game-Portals-to-Submit-Your-Game">here</a>. Unfortunately they are not all automatically accepted. Yesterday I put my game up on a handful of sites, but it is waiting for approval from several other portals.</p>
<p>One of the key features that Mochi Media offers is their distribution system. While not recommended as an only tool for spreading your work, it really helps to get your game around without even lifting a finger. <em>The Great Poop Shoot</em> is still waiting on Mochi to approve it into the distribution system, but after that it should make its way to many more sites.</p>
<p>I&#8217;ll post a follow-up update sometime regarding how much exposure the game received. Until next time &#8230; !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shadywizard.com/2010/02/the-joys-of-distribution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Game: The Great Poop Shoot</title>
		<link>http://www.shadywizard.com/2010/01/new-game/</link>
		<comments>http://www.shadywizard.com/2010/01/new-game/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 02:16:20 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Game News]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flash game]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[new game]]></category>
		<category><![CDATA[poop]]></category>
		<category><![CDATA[shoot]]></category>

		<guid isPermaLink="false">http://www.shadywizard.com/?p=445</guid>
		<description><![CDATA[The new and crude game I mentioned in a previous post is now complete. It&#8217;s called The Great Poop Shoot.  It was a very quick and dirty project, and most of it was done in a few hours over the Thanksgiving holidays. Read more about it and play it under the cut&#8230; There&#8217;s not much [...]]]></description>
			<content:encoded><![CDATA[<p>The new and crude game I mentioned in a previous post is now complete. It&#8217;s called <em>The Great Poop Shoot</em>.  It was a very quick and dirty project, and most of it was done in a few hours over the Thanksgiving holidays. Read more about it and play it under the cut&#8230;</p>
<p><span id="more-445"></span></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="480" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://games.mochiads.com/c/g/the-great-poop-shoot/DudeGame.swf" /><embed type="application/x-shockwave-flash" width="640" height="480" src="http://games.mochiads.com/c/g/the-great-poop-shoot/DudeGame.swf"></embed></object></p>
<p>There&#8217;s not much depth too <em>The Great Poop Shot</em>. You&#8217;re mostly just shooting poos as fast as you can before they get away. Obviously it won&#8217;t be an addicting game, but I&#8217;m quite curious how the subject matter alone will impact its number of plays. I&#8217;ll be sure to report on that later.</p>
<p>Soon I&#8217;ll be going through the process of distributing <em>The Great Poop Shoot.</em> First, I&#8217;ll enable the free distribution option on MochiMedia&#8217;s website. This helps to put the game on some sites without much effort, but it&#8217;s by far not the only thing I&#8217;ll want to do.</p>
<p>After that, I&#8217;ll be going through a list of sites that take game submissions. This is a pretty boring procedure, but it&#8217;s really necessary if I want as many game plays as I can get. One of the best sites for MochiAds games is Mindjolt. They have a pretty large player base, and new games get front-paged for several days. The only problem is that it takes 2-3 months for them to post your game if they approve it. I don&#8217;t think <em>The Great Poop Shoot</em> is really Mindjolt quality, so I won&#8217;t be submitting this one.</p>
<p>Should I try to find a sponsor? This is another situation where I would want a much more in-depth and polished game. Sponsors have a lot of games to choose from, and the good ones aren&#8217;t going to want their brand associated with games made in a day.</p>
<p>I&#8217;ll be writing a follow-up post on everything I did to distribute the game. Enjoy popping some poos!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shadywizard.com/2010/01/new-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Peek-a-Boo Wizard</title>
		<link>http://www.shadywizard.com/2010/01/437/</link>
		<comments>http://www.shadywizard.com/2010/01/437/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 19:00:35 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Development Art]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[peek a boo]]></category>
		<category><![CDATA[stress relief]]></category>
		<category><![CDATA[wizards]]></category>

		<guid isPermaLink="false">http://www.shadywizard.com/?p=437</guid>
		<description><![CDATA[Look What I made! This is a simple task Ethan had me do. We are planning on using it for a splash screen on our flash and iphone games. The animation of the expanding black circle is a little hacked and on flash and the iphone we would be better served to just use a [...]]]></description>
			<content:encoded><![CDATA[<p>Look What I made! This is a simple task Ethan had me do. We are planning on using it for a splash screen on our flash and iphone games.</p>
<p><img class="aligncenter size-full wp-image-440" title="wizardSplashRepeat" src="http://www.shadywizard.com/wp-content/uploads/2010/01/wizardSplashRepeat.gif" alt="wizardSplashRepeat" width="300" height="300" /></p>
<p><span id="more-437"></span>The animation of the expanding black circle is a little hacked and on flash and the iphone we would be better served to just use a mask to do that same effect. How i created that effect in the .gif was I made twenty four layers in Photoshop and scaled the circle 4% each layer.  I probably could have done something with tween frames and all the fancy things that come with Photoshop, but really all i needed to make was the wizard background so the animation suffered.</p>
<p>We made the image to be 300 by 300 pixels so we could fit it in an iphone in both landscape and portrait. The image itself was me reusing the wizard from the header of this site and the ivy covered wall from our navigation background. Little art projects can be fun and they can be a nice relaxing break from staring at code all day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shadywizard.com/2010/01/437/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
