<?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>mat janson blanchet</title>
	<atom:link href="http://jansensan.net/feed" rel="self" type="application/rss+xml" />
	<link>http://jansensan.net</link>
	<description></description>
	<lastBuildDate>Tue, 10 Aug 2010 12:29:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Communication between AS3 and Facebook</title>
		<link>http://jansensan.net/communication-between-as3-and-facebook</link>
		<comments>http://jansensan.net/communication-between-as3-and-facebook#comments</comments>
		<pubDate>Tue, 10 Aug 2010 12:29:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://jansensan.net/?p=312</guid>
		<description><![CDATA[
For a recent project, we needed to have AS3 communicate with Facebook and the other way around. Facebook have created a whole framework around their application, which I believe makes some sense for security purposes, but is unfortunately not documented in an orderly manner.
I do not pretend that I am the first one to write a [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" title="Communication between AS3 and Facebook" src="http://jansensan.net/images/blog/post0015_001.jpg" alt="Communication between AS3 and Facebook" width="640" height="128" /></p>
<p>For a recent project, we needed to have AS3 communicate with Facebook and the other way around. Facebook have created a whole framework around their application, which I believe makes some sense for security purposes, but is unfortunately not documented in an orderly manner.</p>
<p>I do not pretend that I am the first one to write a post about how to communicate between AS3 and Facebook Javascript (or FBJS), but all those tutorials I found expected you to know some thing or another about programming for Facebook, never taking it from the start. So, here goes, communication between AS3 and Facebook for dummies. Or beginners, if you feel offended by the dummy title. Or if it infringes on patents and stuff.</p>
<p><strong>Of knowledge and tools</strong></p>
<p>In this tutorial, I do assume that you have some knowledge of the tools I will present, namely AS3, HTML, JS, CSS and PHP. You, however, do not need to be a master of all (I sure am not).</p>
<p>As presented before, I work in <a title="Eclipse" href="http://www.eclipse.org/" target="_blank">Eclipse</a>, meaning that with the <a title="Flash Builder 4 plugin" href="http://www.adobe.com/products/flashbuilder/" target="_blank">Flash Builder 4 plugin</a>, the <a title="Web Tools Platform" href="http://www.eclipse.org/webtools/" target="_blank">Web Tools Platform</a> and the <a title="PHPEclipse plugin" href="http://www.phpeclipse.com/" target="_blank">PHPElipse plugin</a>, I only need one environment. You will also need to make sure that your server runs PHP. Locally, you can use <a title="MAMP" href="http://www.mamp.info/" target="_blank">MAMP</a> to run a PHP server (thanks to <a title="Antti Kupila" href="http://www.anttikupila.com/" target="_blank">Antti Kupila</a> for the tip on that one).</p>
<p><strong>Facebook's framework</strong></p>
<p>Before we go on writing any code, maybe it is good to know a bit how Facebook works. In order to run JS, Facebook have their own subset or framework which they dubbed <a title="FBJS" href="http://wiki.developers.facebook.com/index.php/FBJS" target="_blank">FBJS</a>.</p>
<p>To embed an SWF, you need to create an <code><a title="Facebook - fb:swf" href="http://wiki.developers.facebook.com/index.php/Fb:swf" target="_blank">fb:swf</a></code> tag. Also, the Flash component does not start automatically, there needs to be a user interaction to trigger the embed of the SWF. It might be be of interest to mention that Facebook supports certain versions of Flash, namely 9 and 10. The exact version numbers can be found in the <a title="Flash Player versions supported on Facebook" href="http://wiki.developers.facebook.com/index.php/Fb:swf#Notes" target="_blank">notes of the <code>fb:swf</code> tag</a>.</p>
<p><strong>The index file</strong></p>
<p>Using PHP is totally optional in this case. Facebook does have a habit of caching files on their servers, therefore instead of having to hardcode all URLs, it is quite practical to use PHP variables. For images and CSS, I sometimes add the <code>time()</code> PHP function so I make sure that the file used is always the latest, like so:</p>
<p>PHP:</p>
<blockquote><p><code>$img_src = "http://www.example.com/images/image.jpg?" . time();</code></p></blockquote>
<p>The <code>time()</code> function is useful during development, but it is best not to use it once you deploy live.</p>
<p>We also need an id for the image element.</p>
<p>PHP:</p>
<blockquote><p><code>$img_id = "click_to_activate_id";</code></p></blockquote>
<p>Now, let's look at the JavaScript:</p>
<p>JavaScript:</p>
<blockquote>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">function</span> embedSWF<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #009900; font-style: italic;">// remove image</span>
	<span style="color: #003366; font-weight: bold;">var</span> image = document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;click_to_activate_id&quot;</span><span style="color: #66cc66;">&#41;</span>;
	document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;swfWrapper&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">removeChild</span><span style="color: #66cc66;">&#40;</span>image<span style="color: #66cc66;">&#41;</span>;
&nbsp;
	<span style="color: #009900; font-style: italic;">// create swf object</span>
	<span style="color: #003366; font-weight: bold;">var</span> swf = document.<span style="color: #006600;">createElement</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;fb:swf&quot;</span><span style="color: #66cc66;">&#41;</span>;
	swf.<span style="color: #006600;">setSWFSrc</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;communication_with_fb.swf&quot;</span><span style="color: #66cc66;">&#41;</span>;
	swf.<span style="color: #006600;">setId</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;communication_with_fb_id&quot;</span><span style="color: #66cc66;">&#41;</span>;
	swf.<span style="color: #006600;">setWidth</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;520&quot;</span><span style="color: #66cc66;">&#41;</span>;
	swf.<span style="color: #006600;">setHeight</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;600&quot;</span><span style="color: #66cc66;">&#41;</span>;
	document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;swfWrapper&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">appendChild</span><span style="color: #66cc66;">&#40;</span>swf<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#125;</span></pre>
</blockquote>
<p>In this block, I create a JS function that removes an image and generates an <code>fb:swf</code> tag in its stead.</p>
<p>PHP:</p>
<p><img class="alignnone" title="PHP Code" src="http://jansensan.net/images/blog/post0015_002.jpg" alt="&lt;div id=&quot;wrapper&quot;&gt; 	&lt;div id=&quot;swfWrapper&quot;&gt; 		&lt;img 			src=&quot;&lt;?php echo $img_src ?&gt;&quot; 			width=&quot;520&quot; height=&quot;600&quot; 			id=&quot;&lt;php echo $img_id ?&gt;&quot; 			class=&quot;hasPointer&quot; 			onclick=&quot;embedSWF()&quot; 		/&gt; 	&lt;/div&gt; &lt;/div&gt;" width="640" height="195" /></p>
<p>This block represents the image that the user will see first. Once the user clicks on the image, the JS function mentioned above is called and the SWF gets embedded.</p>
<p>It is important that the <code>fb:fbjs-bridge</code> tag is place before the wrapper that contains/will contain the SWF, otherwise it will not work.</p>
<p>CSS:</p>
<blockquote>
<pre class="css"><span style="color: #cc00cc;">#wrapper</span>
<span style="color: #66cc66;">&#123;</span>
	width<span style="color: #3333ff;">:<span style="color: #933;">520px</span></span>;
	<span style="color: #000000; font-weight: bold;">background-color</span>:<span style="color: #cc00cc;">#ffffff</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#swfWrapper</span>
<span style="color: #66cc66;">&#123;</span>
	width<span style="color: #3333ff;">:<span style="color: #933;">520px</span></span>;
	height<span style="color: #3333ff;">:<span style="color: #933;">600px</span></span>;
	margin-bottom<span style="color: #3333ff;">:<span style="color: #933;">16px</span></span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#buttonsWrapper</span>
<span style="color: #66cc66;">&#123;</span>
	width<span style="color: #3333ff;">:<span style="color: #933;">520px</span></span>;
	margin<span style="color: #3333ff;">:<span style="color: #933;">0</span></span> <span style="color: #993333;">auto</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.button</span>
<span style="color: #66cc66;">&#123;</span>
	cursor<span style="color: #3333ff;">:pointer</span>;
	background-image<span style="color: #3333ff;">:url</span><span style="color: #66cc66;">&#40;</span>../images/button<span style="color: #6666ff;">.jpg</span><span style="color: #66cc66;">&#41;</span>;
	width<span style="color: #3333ff;">:<span style="color: #933;">96px</span></span>;
	height<span style="color: #3333ff;">:<span style="color: #933;">16px</span></span>;
	margin<span style="color: #3333ff;">:<span style="color: #933;">0</span></span> <span style="color: #993333;">auto</span>;
	padding<span style="color: #3333ff;">:<span style="color: #933;">4px</span></span> <span style="color: #933;">0</span>;
	font-family<span style="color: #3333ff;">:Helvetica</span>, Arial, <span style="color: #993333;">sans-serif</span>;
	font-size<span style="color: #3333ff;">:<span style="color: #933;">16px</span></span>;
	text-align<span style="color: #3333ff;">:center</span>;
	<span style="color: #000000; font-weight: bold;">color</span>:<span style="color: #cc00cc;">#<span style="color: #933;">000</span></span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.hasPointer</span>
<span style="color: #66cc66;">&#123;</span>
	cursor<span style="color: #3333ff;">:pointer</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</blockquote>
<p>This last block is just some CSS to hold the visuals together.</p>
<p><strong>Of ActionScript and FBML interaction</strong></p>
<p>Usually, when it is necessary to have AS3 interact with JS, one can simply use the <code><a title="AS3 Doc - ExternalInterface" href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html" target="_blank">ExternalInterface</a></code> class. Most probably for security reasons, Facebook makes our lives a bit more complicated when we need such an interaction once in their framework. As I said before, we have to use their FBJS Bridge. Let's see how.</p>
<p>As the SWF is embedded into Facebook, it receives a multitude of variables, which are listed in the <a title="FB Doc - fb:swf" href="http://wiki.developers.facebook.com/index.php/Fb:swf" target="_blank">older version of FB's doc</a>. There are two that are of interest to us here: "<code>fb_local_connection</code>" and "<code>fb_fbjs_connection</code>". These are the variable names needed to respectively create an outgoing connection and an incoming connection.</p>
<p>ActionScript 3.0:</p>
<blockquote>
<pre class="actionscript"><span style="color: #000000; font-weight: bold;">var</span> _outgoingConnection:<span style="color: #0066CC;">LocalConnection</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">LocalConnection</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> _outgoingConnectionName:<span style="color: #0066CC;">String</span> = loaderInfo.<span style="color: #006600;">parameters</span>.<span style="color: #006600;">fb_local_connection</span>;
<span style="color: #000000; font-weight: bold;">var</span> _incomingConnection:<span style="color: #0066CC;">LocalConnection</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">LocalConnection</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> _incomingConnectionName:<span style="color: #0066CC;">String</span> = loaderInfo.<span style="color: #006600;">parameters</span>.<span style="color: #006600;">fb_fbjs_connection</span>;</pre>
</blockquote>
<p>In the case of the outgoing connection, we use the name when calling a JS function, like so:</p>
<p>ActionScript 3.0:</p>
<blockquote>
<pre class="actionscript">_outgoingConnection.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span>_outgoingConnectionName, <span style="color: #ff0000;">&quot;callFBJS&quot;</span>, <span style="color: #ff0000;">&quot;fbjsFunctionForAS3&quot;</span>, <span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;Message from AS3&quot;</span>, <span style="color: #ff0000;">&quot;Hello Facebook!&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</pre>
</blockquote>
<p>Note that in this function, the second arguments must always be "callFBJS", as Facebook uses a <code><a title="AS Doc - LocalConnection" href="http://192.150.8.60/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/LocalConnection.html" target="_blank">LocalConnection</a></code> in an SWF of their own to communicate with JS in their framework.</p>
<p>The third argument is the name of the JS function you need to be called from Flash, and the last is an array of the arguments needed.</p>
<p>JavaScript:</p>
<blockquote>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">function</span> fbjsFunctionForAS3<span style="color: #66cc66;">&#40;</span>title, message<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">new</span> Dialog<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">showMessage</span><span style="color: #66cc66;">&#40;</span>title, message<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</blockquote>
<p>Another idiosyncrasy of Facebook is that the usual <code>alert()</code> JS function is not available. It may be frustrating at first, but their framework provide a solution that uses their own UI, which can be more interesting. As seen above, you can simply create a new Dialog() and right away call the showMessage() function, a blue Facebook window will pop over your text content. HTML is unfortunately not permitted there.</p>
<p>Now, you may also want to call AS3 functions from JS. Let's take a look at how this would work.</p>
<p>ActionScript 3.0:</p>
<blockquote>
<pre class="actionscript">_incomingConnection.<span style="color: #006600;">client</span> = <span style="color: #0066CC;">this</span>;
_incomingConnection.<span style="color: #0066CC;">connect</span><span style="color: #66cc66;">&#40;</span>_incomingConnectionName<span style="color: #66cc66;">&#41;</span>;</pre>
</blockquote>
<p>The first thing to do is to set a client to the connection, meaning what is the scope of the functions that the FBJS Bridge will call. I like to keep it at the same level as the class. Then, connect the connection.</p>
<p>You simply need to make a function available to be called.</p>
<p>ActionScript 3.0:</p>
<blockquote>
<pre class="actionscript"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> as3FunctionForFBJS<span style="color: #66cc66;">&#40;</span>title:<span style="color: #0066CC;">String</span>, <span style="color: #0066CC;">message</span>:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>title, <span style="color: #0066CC;">message</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</blockquote>
<p>And let's see how to call it from the Javascript side:</p>
<p>JavaScript:</p>
<blockquote>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">function</span> fbjsFunctionForAS3<span style="color: #66cc66;">&#40;</span>title, message<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> swf document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;click_to_activate_id&quot;</span><span style="color: #66cc66;">&#41;</span>;
	swf.<span style="color: #006600;">callSWF</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;as3FunctionForFBJS&quot;</span>, <span style="color: #3366CC;">&quot;Message from Facebook&quot;</span>, <span style="color: #3366CC;">&quot;Hello AS3!&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</blockquote>
<p>Obviously at this point you need UI elements to trigger these functions, but I leave that for you to figure out and create.</p>
<p><strong>Setting up the Facebook application</strong></p>
<p>First, you should head to Adobe's website where some tutorials present you with the basics of what you need to know (<a title="Getting your head around Flash on Facebook" href="http://www.adobe.com/devnet/facebook/articles/flash_on_facebook.html" target="_blank">link 1</a>, <a title="Build your first Facebook application" href="http://www.adobe.com/devnet/facebook/articles/video_facebook_quick_start.html" target="_blank">link 2</a>, <a title="Create your first Flex and Facebook web application – Part 1: Build and test locally" href="http://www.adobe.com/devnet/facebook/articles/first_flex_facebook_web_app_pt1.html" target="_blank">link 3</a>).</p>
<p>Once you created your app and all, make sure that your "Render Method" is set to "FBML" in the app settings:</p>
<p><strong><em><img class="aligncenter" title="Facebook App - Set Render Method to FBML" src="http://jansensan.net/images/blog/post0015_003.jpg" alt="" width="640" height="460" /><br />
</em></strong></p>
<p>There you go! You are now ready to have your Facebook projects communicate with AS3 and vice versa.</p>
<p><strong>Resources</strong></p>
<p>You may get the sources for this tutorial <a title="Tutorial sources" href="http://code.google.com/p/tutorial-communication-between-as3-and-facebook/" target="_blank">here</a>.</p>
<p>You may test what I have presented in this tutorial: <a title="Facebook App - Communication between AS3 and Facebook" href="http://apps.facebook.com/flash-to-fb/" target="_blank">http://apps.facebook.com/flash-to-fb/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jansensan.net/communication-between-as3-and-facebook/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Communication between AS3 and Max/MSP/Jitter</title>
		<link>http://jansensan.net/communication-between-as3-and-max-msp-jitter</link>
		<comments>http://jansensan.net/communication-between-as3-and-max-msp-jitter#comments</comments>
		<pubDate>Thu, 27 May 2010 21:37:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Max/MSP/Jitter]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://jansensan.net/?p=298</guid>
		<description><![CDATA[
A while back, I thought of adding a touch screen film onto my laptop's screen, so I could use Max/MSP/Jitter's incredible sound processing tools and interface more easily than keyboard and mouse in the context of an installation or a performance. It turns out that a couple of years later, screens are touchable more easily, [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" title="Communication between AS3 and Max/MSP/Jitter" src="http://jansensan.net/images/blog/post0014_001.jpg" alt="Communication between AS3 and Max/MSP/Jitter" width="640" height="128" /></p>
<p>A while back, I thought of adding a touch screen film onto my laptop's screen, so I could use <a title="Max" href="http://cycling74.com/products/maxmspjitter/" target="_blank">Max/MSP/Jitter</a>'s incredible sound processing tools and interface more easily than keyboard and mouse in the context of an installation or a performance. It turns out that a couple of years later, screens are touchable more easily, although I have yet to find a tablet that will be interesting enough for me to buy and want to use with Max.</p>
<p>Nevertheless, I had fiddled around with AS3 to communicate with Max. I had planned for a while to write a post about this, but I thought it was more important to present how to start and manage a project. What I will present here is how to communicate data between the two software, and since Max is a desktop installation, I will create a pure AS3 <a title="Adobe Air" href="http://www.adobe.com/products/air/" target="_blank">Air</a> project.</p>
<p>Just to give credit where credit is due, steps to create the Air project are mostly taken from <a title="Easily Create a Pure AS3 AIR Project in Flash Builder 4" href="http://swfhead.com/blog/?p=380" target="_blank">here</a>. Let's have at it now!</p>
<p><strong>Create an Air Project</strong></p>
<p style="text-align: center;"><img class="aligncenter" title="Create an Air Project (step 1)" src="http://jansensan.net/images/blog/post0014_002.jpg" alt="Create an Air Project (step 1)" width="640" height="709" /></p>
<p>Let's first create a Flex project in Flash Builder 4. Right-click in the package explorer window, select "New &gt; Flex Project". Make sure that you check the "Desktop (runs in Adobe Air)" option in the "Application type" subsection, you do not want to make a web project.</p>
<p style="text-align: center;"><img class="aligncenter" title="Create an Air Project (step 2)" src="http://jansensan.net/images/blog/post0014_003.jpg" alt="Create an Air Project (step 2)" width="640" height="818" /></p>
<p>In the next window, leave the "Output folder" field as is and click "Next". Then, in the "Main application" field, change the .MXML extension to .AS and click "Finish."</p>
<p>As a habit, I always have a initStage() function. In Air, you need to spawn an actual window, something we never do for the web. This is the perfect place to do so.</p>
<p>ActionScript 3.0:</p>
<blockquote>
<pre class="actionscript"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> initStage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #808080; font-style: italic;">// first, spawn a window</span>
	<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">nativeWindow</span>.<span style="color: #006600;">activate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #808080; font-style: italic;">// then set stage params</span>
	<span style="color: #0066CC;">stage</span>.<span style="color: #0066CC;">align</span> = StageAlign.<span style="color: #006600;">TOP_LEFT</span>;
	<span style="color: #0066CC;">stage</span>.<span style="color: #0066CC;">scaleMode</span> = StageScaleMode.<span style="color: #006600;">NO_SCALE</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</blockquote>
<p>In order to communicate with Max, we need to create an <a title="XMLSocket - AS3 Documentation" href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/XMLSocket.html" target="_blank">XMLSocket</a>.</p>
<p>ActionScript 3.0:</p>
<blockquote>
<pre class="actionscript"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _socket:<span style="color: #0066CC;">XMLSocket</span>;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _host:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span>;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _port:uint = <span style="color: #cc66cc;">8080</span>;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> initSocket<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	_socket = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">XMLSocket</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	_socket.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>IOErrorEvent.<span style="color: #006600;">IO_ERROR</span>, xmlSocketEventsHandler<span style="color: #66cc66;">&#41;</span>;
	_socket.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #0066CC;">CONNECT</span>, xmlSocketEventsHandler<span style="color: #66cc66;">&#41;</span>;
	_socket.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #0066CC;">CLOSE</span>, xmlSocketEventsHandler<span style="color: #66cc66;">&#41;</span>;
	_socket.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>DataEvent.<span style="color: #0066CC;">DATA</span>, xmlSocketDataHandler<span style="color: #66cc66;">&#41;</span>;
	_socket.<span style="color: #0066CC;">connect</span><span style="color: #66cc66;">&#40;</span>_host, _port<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> xmlSocketEventsHandler<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, <span style="color: #0066CC;">this</span>, <span style="color: #ff0000;">&quot;--- xmlSocketEventsHandler ---&quot;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">switch</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #0066CC;">type</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">case</span> <span style="color: #ff0000;">&quot;ioError&quot;</span>:
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>could not connect&quot;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">break</span>;
&nbsp;
		<span style="color: #b1b100;">case</span> <span style="color: #ff0000;">&quot;connect&quot;</span>:
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>socket connected&quot;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">break</span>;
&nbsp;
		<span style="color: #b1b100;">case</span> <span style="color: #ff0000;">&quot;close&quot;</span>:
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>socket closed&quot;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">break</span>;
&nbsp;
		<span style="color: #000000; font-weight: bold;">default</span>:
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> + event.<span style="color: #0066CC;">type</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">break</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
</blockquote>
<p>There are a couple of things to go through here. At the top of this code block, I instantiate the XMLSocket. I also create variables for the host and the port, which are both necessary to connect the XMLSocket.</p>
<p>Then, the initSocket() function takes care of initializing the XMLSocket, also adding some listeners to it and finally connecting it. For the connection, you may want to read about your platform (whether it's Windows, Mac OS or other) to see what is the host IP and what ports can be used locally. You may also read up a bit on the Flash Player security, in case you need a cross domain XML file, although since this project is desktop-based and not going through a browser, I did not need it.</p>
<p>The xmlSocketEventsHandler() simply traces what events the XMLSocket receives.</p>
<p><strong>Create a Max patch</strong></p>
<p>Max files are called patches. It goes back to patching cords, but I won't go too deep into the Max language, you may read all about it yourself on the Internet.</p>
<p>By default, Max does not communicate with Flash, but just like AS3, there are some "libraries" that can be added to Max, they are called externals. A couple of years back, the Flashserver external was easy to obtain from the <a title="Flashserver - Olaf Matthes" href="http://www.nullmedium.de/dev/flashserver/" target="_blank">author's website</a> or from the <a title="Flashserver - Max Object Database" href="http://www.maxobjects.com/?v=objects&amp;id_objet=2487&amp;requested=FLASH&amp;operateur=AND&amp;id_plateforme=0&amp;id_format=0" target="_blank">Max Objects Database</a>, but it is sadly not the case anymore. I still have it and it is bundled with the source files for this tutorial, I hope I am not infringing anyone's copyrights by making it available again.</p>
<p>Then let's create a new patch and add the Flashserver object. This post is unfortunately not about how to use Max, thus I will not explain how to use the software here. I may in some future post, but this is way out of scope for this post.</p>
<p style="text-align: center;"><img class="aligncenter" title="Max patch" src="http://jansensan.net/images/blog/post0014_004.jpg" alt="Max patch" width="451" height="578" /></p>
<p>Simply look at the help for the Flashserver object if you need to, but quickly, after the name is the argument for what port to connect to ("8080") , and the last argument ("256") is the amount of clients or Flash applications that can connect to this Max patch.</p>
<p><strong>Talking with Max</strong></p>
<p>When Flash needs to communicate with other languages and software, the other software usually has the role of a server, therefore it needs to be opened before the Flash/Air app. Thus, make sure you open the Max patch before attempting to communicate with Flash.</p>
<p>First, let's look at receiving what Max may send to Flash. Earlier, there was one event handler that I did not define, here it is:</p>
<p>ActionScript 3.0:</p>
<blockquote>
<pre class="actionscript"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> xmlSocketDataHandler<span style="color: #66cc66;">&#40;</span>event:DataEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</blockquote>
<p><strong><span style="font-weight: normal;">So the data is actually what Max sends to Flash. To send multiple values to Flash, you'll need to create a pack in Max and send it as a string and then parse it in Flash.</span></strong></p>
<p><strong><span style="font-weight: normal;">Let's look at the code to send data to Max:</span></strong></p>
<p>ActionScript 3.0:</p>
<blockquote>
<pre class="actionscript">_socket.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;hello max;&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre>
</blockquote>
<p><strong><span style="font-weight: normal;">It's as simple as that! Note that the data always has to end with a semicolon (";"). In the case where there are multiple values that need to be sent, separate them all with a semicolon, like so:</span></strong></p>
<p>ActionScript 3.0:</p>
<blockquote>
<pre class="actionscript">_socket.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;hello max; from flash;&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre>
</blockquote>
<p>On Max's side, simply use the unpack object to be able to parse the values into your patch.</p>
<p><strong>Source files</strong></p>
<p>As promised, <a href="http://jansensan.net/compressed/Tutorial_CommunicationWithMax.zip">here are the files</a> that I used to create this project. The Air project was created in Eclipse with the Flash Builder 4 plugin, and the Max patch with Max 5, with the Flashserver external installed.</p>
]]></content:encoded>
			<wfw:commentRss>http://jansensan.net/communication-between-as3-and-max-msp-jitter/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Planning the production of an interactive project</title>
		<link>http://jansensan.net/planning-the-production-of-an-interactive-project</link>
		<comments>http://jansensan.net/planning-the-production-of-an-interactive-project#comments</comments>
		<pubDate>Mon, 03 May 2010 21:05:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://jansensan.net/?p=285</guid>
		<description><![CDATA[As a creative developer and an interaction designer, I need to either produce or guide the production of interactive projects. Needless to say, to non technical people such as designers, producers and account managers, we do some black magic and create the most amazing things. But what are the ingredients of this magic? Mostly organizational [...]]]></description>
			<content:encoded><![CDATA[<p>As a creative developer and an interaction designer, I need to either produce or guide the production of interactive projects. Needless to say, to non technical people such as designers, producers and account managers, we do some black magic and create the most amazing things. But what are the ingredients of this magic? Mostly organizational skills I would say.</p>
<p>I have originally planned to help and guide students and beginners with this blog, to use the posts as notes and references for some tutorials I have given at <a title="Concordia University - Computation Arts" href="http://computationarts.concordia.ca/" target="_blank">Concordia University</a> in Montréal. I strongly believe that it is the responsibility of senior developers and creatives to provide newcomers to this overwhelming field with the proper tools to learn to work efficiently and professionally.</p>
<p>Because, let's face it schools and universities fail in this domain. These institutions do not aim "to create mindless production drones for the interactive industry blah blah blah..." This is such a hypocritical argument that could be easily refuted by looking at how computer engineering or administration programs teach students how to be organized in their thoughts and workflow. Others have actually had confrontations much stronger than I and have lived to <a title="What’s Wrong with Ontario Colleges?" href="http://www.untoldentertainment.com/blog/2010/02/18/whats-wrong-with-ontario-colleges-part-1/" target="_blank">tell about it</a>.</p>
<p>For my part, I have chosen to provide <a title="Sid Lee" href="http://sidlee.com" target="_blank">Sid Lee</a>, where I currently work, with information and references to good practices in the form of a wiki. A wiki is easy to update and it is a well known way to organize information, so most people can navigate quickly.</p>
<p>Also, most things in many people's jobs do not need to be remembered by heart. Hell, I hope nobody says stuff without references, especially technical references necessary for a project! That is why such references are useful, especially for training newcomers and simply for keeping inline with company policies.</p>
<p>In the wiki, I presented what is needed for a project from many players in the process of the production, such as producers, designers and interactive developers. This is an internal tool not available to the public, but today I stumbled upon an article, <a title="What To Deliver A Flash Developer" href="http://evolve.reintroducing.com/2010/05/03/tips-n-tricks/what-to-deliver-a-flash-developer/" target="_blank">What to Deliver a Flash Developer</a>, which highlights a lot of the similar points that I have brought up to many kick off meetings. Since this blog is aimed at helping developers to learn good practices, I thought it would be a good idea to republish and comment on the post.</p>
<p>Note that I am careful in not utilizing the term "Flash developer" as the authors of the post did, as I believe this is plain wrong. Do we call designers "Photoshoppists"? Flash is just a tool currently used often in the creation of RIAs, but it is not and will not always be the case. Some of us work with ActionScript, some others with PHP, with CSS, with HTML, with Objective-C, with Android, with Java, with OpenFrameworks, etc. Specialists exist indeed in all fields, but workflows for RIAs, games and other interactive projects are not confined to Flash development.</p>
<p>Whatever rant or complaint I may seem to voice here, the article aforementioned is a great read for anybody who wishes to manage development of projects, or simply to make sure that parts are not forgotten along the way.</p>
]]></content:encoded>
			<wfw:commentRss>http://jansensan.net/planning-the-production-of-an-interactive-project/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Modding a gaming console is illegal in Canada</title>
		<link>http://jansensan.net/modding-a-gaming-console-is-illegal-in-canada</link>
		<comments>http://jansensan.net/modding-a-gaming-console-is-illegal-in-canada#comments</comments>
		<pubDate>Wed, 07 Apr 2010 17:06:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Legal]]></category>
		<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Technologies]]></category>

		<guid isPermaLink="false">http://jansensan.net/?p=274</guid>
		<description><![CDATA[Today, Michael Geist tweeted:
RCMP release states modifying gaming console illegal under Criminal Code, punishable to 10 yrs jail. http://bit.ly/929P9z
Obviously, the logic behind this choice is sound. Lots of people were offering services to modify the electronics inside gaming consoles ever since the publication of the first PlayStation to allow said console to play copied CDs.
If [...]]]></description>
			<content:encoded><![CDATA[<p>Today, <a title="Michael Geist's Blog" href="http://www.michaelgeist.ca/" target="_blank">Michael Geist</a> tweeted:</p>
<blockquote><p>RCMP release states modifying gaming console illegal under Criminal Code, punishable to 10 yrs jail. <a title="The RCMP Arrests One Suspect for Illegal Reproduction of Video Games" href="http://bit.ly/929P9z" target="_blank">http://bit.ly/929P9z</a></p></blockquote>
<p>Obviously, the logic behind this choice is sound. Lots of people were offering services to modify the electronics inside gaming consoles ever since the publication of the first <a title="Wikipedia - PlayStation" href="http://en.wikipedia.org/wiki/PlayStation" target="_blank">PlayStation</a> to allow said console to play copied CDs.</p>
<p>If you did not know, ever since the gaming consoles ditched the <a title="Wikipedia - ROM Cartridge" href="http://en.wikipedia.org/wiki/Game_cartridge" target="_blank">cartridge</a>, CDs and DVDs have been used as the media holding the video game. And that switch was made when CD burners became standard on all computers. Companies put in place different ways (software/hardware) to prevent people from simply copying their games.</p>
<p>As usual, other people found a way to circumvent that type of restriction. In Montréal alone, I knew of two stores that were openly modding consoles to allow copied games to work. These stores also openly offered copied games. And let's not talk about what could be found in the classified.</p>
<p>Thus, a law like this is obviously to prevent people from making a business out of ripping off another business.</p>
<p>Where this law fails however, I believe, is how narrow it is in <a title="Wikipedia - Section 342.1 of the Criminal Code of Canada" href="http://en.wikipedia.org/wiki/Criminal_code_section_342#Section_342.1.5B4.5D" target="_blank">its wording</a>. What I understand of this, as I am not a law specialist in any shape or form, is that I am not allowed to modify a console or a computer that I purchased and that I now own. I have not found clear references that would state something like "the console cannot be modified to play pirated games" or such language, but rather simply that consoles cannot be modified.</p>
<p>And that scares me. Apple trying to lock down their devices, <a title="Apple's iPad: The End Of The Internet As We Know It?" href="http://www.npr.org/templates/story/story.php?storyId=125561844" target="_blank">seemingly to control what of the Internet will be viewable on their devices</a>. Governments aligning themselves to render illegal a lot of tools—yes to prevent piracy, but seemingly not being careful enough in their wording that digital rights are deleted along the way.</p>
<p>As a digital artisan and someone who likes to tinker with electronics for fun and for creating <a title="Portfolio - Sound Pez" href="http://jansensan.net/portfolio/#/tangible/sound_pez" target="_blank">artistic projects</a>, I see this trend as a slippery slope to prevent <a title="Wikipedia - Hacker (Hobbyist)" href="http://en.wikipedia.org/wiki/Hacker_(hobbyist)" target="_blank">hacking</a>—in the noble sense—and digital creativity. People learn a lot by destroying and rebuilding devices. Rendering this illegal without taking the side described here into account may lead to unfortunate lawsuits. Were not <a title="Patents" href="http://ignorethecode.net/blog/2010/03/09/patents/" target="_blank">patents put in place so that the discoveries be shared with other scientists and enthusiasts</a>?</p>
]]></content:encoded>
			<wfw:commentRss>http://jansensan.net/modding-a-gaming-console-is-illegal-in-canada/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>adidas Originals publishes Women&#8217;s Lookbook</title>
		<link>http://jansensan.net/adidas-originals-womens-lookbook-ss10</link>
		<comments>http://jansensan.net/adidas-originals-womens-lookbook-ss10#comments</comments>
		<pubDate>Wed, 17 Mar 2010 18:19:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Commercial Works]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Localization]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://jansensan.net/?p=167</guid>
		<description><![CDATA[


After two arduous months of work—and during the hassle of me moving to Amsterdam nonetheless!—we finally managed complete the production of the adidas Originals Women's Lookbook SS10!
Lots of thought went into the architecture of that project so it would be easy to debug. I chose a homebrew MVC pattern for the structure, which worked well. [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: center;">
<div><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="351" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="FlashVars" value="culture=us" /><param name="allowScriptAccess" value="always" /><param name="flashvars" value="culture=us" /><param name="src" value="http://www.adidas.com/campaigns/originals_ss10/content/microsites/womenslookbook/embed/AdidasWLB_Loader.swf" /><embed type="application/x-shockwave-flash" width="480" height="351" src="http://www.adidas.com/campaigns/originals_ss10/content/microsites/womenslookbook/embed/AdidasWLB_Loader.swf" allowscriptaccess="always" flashvars="culture=com"></embed></object></div>
</div>
<p>After two arduous months of work—and during the hassle of me moving to Amsterdam nonetheless!—<a title="Sid Lee" href="http://www.sidlee.com/" target="_blank">we</a> finally managed complete the production of the <a title="adidas Originals Women's Lookbook SS10" href="http://www.adidas.com/originals/womenslookbook" target="_blank">adidas Originals Women's Lookbook SS10</a>!</p>
<p>Lots of thought went into the architecture of that project so it would be easy to debug. I chose a homebrew <a title="MVC pattern" href="http://en.wikipedia.org/wiki/Model–view–controller" target="_blank">MVC pattern</a> for the structure, which worked well. Looking at <a title="My colleague, Antti Kupila" href="http://www.anttikupila.com/" target="_blank">my colleague</a> working with <a title="Robot Legs" href="http://www.robotlegs.org/" target="_blank">RobotLegs</a>, I believe this is what I'll look into next.</p>
<p>The localization worked like a charm with the <a title="Of localization and locale mapping" href="http://jansensan.net/locale-mapping" target="_blank">locale mapping logic I wrote about before</a>. The only issue I found is that since there were no specific fonts for non latin languages, there had to be a check to see what alphabet was used, to  make sure that the fonts were not embedded if said alphabet was non latin.</p>
<p>The video had to stream in this case since we needed to jump at any moment in time in the video. Also, we faced an inconvenience when <a title="BitmapData.draw() AS3 Documentation" href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/BitmapData.html#draw()" target="_blank">trying to get a bitmap from a streaming video</a>, the <a title="Fixing BitmapData.draw() Security Sandbox Violation" href="http://www.thebluepipe.com/Developer/tutorials/as3/Crossdomain-Video-Snapshot-Fixing-BitmapData-draw-Security-Sandbox-Violation.html" target="_blank">solutions were on the server side</a>.</p>
<p>Integrating the whole project into an existing parent SWF was also a challenge, since the class definitions would be kept in the appdom memory and causing issues when loading the site a second time. The solution to this was to apply an application domain when loading the microsite (<a title="Being a Successful Development Team in Flash with Application Domains" href="http://codeendeavor.com/archives/468" target="_blank">link 1</a>, <a title="Application Domain and External SWF Loading" href="http://annafilina.com/blog/application-domain-and-external-swf-loading/" target="_blank">link 2</a>).</p>
<p>As I was looking for solutions, I found that <a title="maashaack - ActionScript 3 framework, tools, libraries and utilities" href="http://code.google.com/p/maashaack/wiki/Main" target="_blank">wiki</a> that is discussing about things like thinking in AS3, metadata, singletons, application domains and all sorts of interesting subjects.</p>
<p>All in all, that project was a good challenge, one I had been looking forward to for a while now.</p>
<p>The embeddable version seen in this post actually has been produced by <a title="Département" href="http://www.departement.ca/" target="_blank">Département</a> in Montréal.</p>
]]></content:encoded>
			<wfw:commentRss>http://jansensan.net/adidas-originals-womens-lookbook-ss10/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding web browsers to Eclipse on Mac OS X</title>
		<link>http://jansensan.net/adding-web-browsers-to-eclipse</link>
		<comments>http://jansensan.net/adding-web-browsers-to-eclipse#comments</comments>
		<pubDate>Sun, 28 Feb 2010 22:23:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Eclipse]]></category>

		<guid isPermaLink="false">http://jansensan.net/?p=162</guid>
		<description><![CDATA[As a web developer, I need to be able to use many browsers. I also use one browser for actually browsing the web, and another to develop.
Eclipse offers the possibility to target browsers. Simply go into the preferences of Eclipse, then into the "General" section, and then into the "Web Browser" subsection. You can next [...]]]></description>
			<content:encoded><![CDATA[<p>As a web developer, I need to be able to use many browsers. I also use one browser for actually browsing the web, and another to develop.</p>
<p>Eclipse offers the possibility to target browsers. Simply go into the preferences of Eclipse, then into the "General" section, and then into the "Web Browser" subsection. You can next check the "Use external Web browser" to use a browser that is not part of Eclipse.</p>
<p><img class="alignnone" title="Eclipse Web browser preferences" src="http://jansensan.net/images/blog/post0010_001.jpg" alt="" width="640" height="360" /></p>
<p>If your browser of choice is not on that list, you can click on "New" to add another one.</p>
<p><img class="aligncenter" title="Add new browser to Eclipse" src="http://jansensan.net/images/blog/post0010_002.jpg" alt="" width="455" height="239" /></p>
<p>For example, I add Safari here. I selected the application from the "Applications" folder, however I got this:</p>
<p><img class="aligncenter" title="Error when adding a browser in Eclipse" src="http://jansensan.net/images/blog/post0010_003.jpg" alt="" width="518" height="137" /></p>
<p>That is quite baffling... I did as I usually would by selecting the Safari.app file, and got an error. I will be honest, I have no idea if this occurs on Windows, as I do not have access to that OS anymore.</p>
<p>I decided to try something before I googled for anything. I decided to go into the package content of the application.</p>
<p>If you are not familiar with this, know that in Mac OS X you can right-click onto an application and select "Show Package Contents". This will present you the files that make up the application. The actual application file can be found in the "Contents/MacOS" folder.</p>
<p>Now, you cannot do all that from the Finder window that opens when you browse for files from an application. I believe that in this regards, Windows is better, since you actually have access to all the functionalities of the File Explorer even when browsing from whithin applications.</p>
<p>So, where does that leave us? Well, then the idea is to get the location of the file outside of Eclipse. You can always get such a location by dragging a file into the Terminal, or even into Spotlight. Then copy that location and paste it in the appropriate field.</p>
<p>There you go, multiple browsers are now available to you!</p>
]]></content:encoded>
			<wfw:commentRss>http://jansensan.net/adding-web-browsers-to-eclipse/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash Player Security Settings to Develop Locally</title>
		<link>http://jansensan.net/flash-player-security-settings-to-develop-locally</link>
		<comments>http://jansensan.net/flash-player-security-settings-to-develop-locally#comments</comments>
		<pubDate>Thu, 25 Feb 2010 21:28:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://jansensan.net/?p=143</guid>
		<description><![CDATA[When developing locally, you may encounter errors when loading data or classes dynamically. By default the Flash Player is set to only work in a certain sandbox, which limits its access.
Honestly, all that stuff is too complex for me to care.
What you and I really want, is to be able to develop our projects locally [...]]]></description>
			<content:encoded><![CDATA[<p>When developing locally, you may encounter errors when loading data or classes dynamically. By default the Flash Player is set to only work in a certain sandbox, which limits its access.</p>
<p>Honestly, all that stuff is too complex for me to care.</p>
<p>What you and I really want, is to be able to develop our projects locally without issues, because let's face it, we trust our own actions. The following simple steps will present how to set the Flash Player Security settings for you to be able to work without hinderance.</p>
<p>First, head to the <a title="Flash Player Security Settings" href="http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html" target="_blank">Flash Player Security Settings</a> page. Yes, it is online and you can only access it if you are connected to the Internet. It is ridiculous, I know, it should be available from other means, like right-clicking on a Flash Player object, but it is not so.</p>
<p>Then, you will encounter this:</p>
<p><img class="aligncenter" title="Flash Player Global Security Settings" src="http://jansensan.net/images/blog/post0009_security_settings.jpg" alt="Flash Player Global Security Settings" width="395" height="270" /></p>
<p>If it is not already, select the Global Security Settings tab (3rd one, as seen above).</p>
<p><img class="aligncenter" title="Edit Locations" src="http://jansensan.net/images/blog/post0009_edit_locations.jpg" alt="Edit Locations" width="169" height="83" /></p>
<p>Click on “Edit locations” and select “Add location...”</p>
<p><img class="aligncenter" title="Browse for Folder" src="http://jansensan.net/images/blog/post0009_browse_for_folder.jpg" alt="Browse for Folder" width="395" height="270" /></p>
<p>Select “Browse for folder” and select the folder to which you want Flash Player to have access. I chose the whole computer so I can work properly.</p>
<p>And voilà! You now can now load XML files and dynamic classes easily without facing unexpected errors.</p>
<p>Once you have done it you will not need to do it again, but when you change computers or reformat one, it's not necessarily something you think at first. This is when this post will become useful!</p>
]]></content:encoded>
			<wfw:commentRss>http://jansensan.net/flash-player-security-settings-to-develop-locally/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Of localization and locale mapping</title>
		<link>http://jansensan.net/locale-mapping</link>
		<comments>http://jansensan.net/locale-mapping#comments</comments>
		<pubDate>Sun, 21 Feb 2010 20:06:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Localization]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Workflow]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://jansensan.net/?p=132</guid>
		<description><![CDATA[When creating web content for international clients, it is more than likely that you will have to think of localized versions of your website. This mostly means that the copy has to be translated into multiple languages.
In this post I will try to present what I believe is a simple way to deal with localization [...]]]></description>
			<content:encoded><![CDATA[<p>When creating web content for international clients, it is more than likely that you will have to think of localized versions of your website. This mostly means that the copy has to be translated into multiple languages.</p>
<p>In this post I will try to present what I believe is a simple way to deal with localization and minimize file copying etc.</p>
<p>I learned of localization when I was working at an e-commerce production shop previously. That company had most of its clients in Canada and in the US, meaning that we only had to deal with a minimal amount of localization, namely "en-US", "en-CA" and "fr-CA".</p>
<p>If you have no idea what those codes are about, the first two letters represent the language (following the <a title="ISO 639-2" href="http://en.wikipedia.org/wiki/ISO_639-2" target="_blank">ISO 639-2</a> codes) and the las two letters represent the country (following the <a title="ISO 3166-1" href="http://en.wikipedia.org/wiki/ISO_3166-1" target="_blank">ISO 3166-1</a> codes).</p>
<p>Recently I had to complete projects for an employee that left the company I currently work for. I had actually never dealt with localization in Europe and obviously, that means a lot more languages. I also discovered that some countries reuse copy. For example, the swedish and greek localization of one of our client's site reuse the english copy. The way the project was set up at that moment was to have one directory per country, meaning that we had to remember to duplicate the english copy into all the directories that used that language as well.</p>
<p>A recipe for disasters.</p>
<p>Here is where the idea of mapping becomes useful. In the site's config file, I simply thought of adding a node that would contain the locale mapping, meaning what country is associated to what language etc.</p>
<p>XML:</p>
<blockquote>
<pre class="actionscript">&lt;localeMapping&gt;
     &lt;locale country=<span style="color: #ff0000;">&quot;ca&quot;</span> <span style="color: #0066CC;">language</span>=<span style="color: #ff0000;">&quot;en&quot;</span> alphabet=<span style="color: #ff0000;">&quot;latin&quot;</span> /&gt;
     &lt;locale country=<span style="color: #ff0000;">&quot;cf&quot;</span> <span style="color: #0066CC;">language</span>=<span style="color: #ff0000;">&quot;fr&quot;</span> alphabet=<span style="color: #ff0000;">&quot;latin&quot;</span> /&gt;
     &lt;locale country=<span style="color: #ff0000;">&quot;fr&quot;</span> <span style="color: #0066CC;">language</span>=<span style="color: #ff0000;">&quot;fr&quot;</span> alphabet=<span style="color: #ff0000;">&quot;latin&quot;</span> /&gt;
     &lt;locale country=<span style="color: #ff0000;">&quot;jp&quot;</span> <span style="color: #0066CC;">language</span>=<span style="color: #ff0000;">&quot;ja&quot;</span> alphabet=<span style="color: #ff0000;">&quot;japanese&quot;</span> /&gt;
     &lt;locale country=<span style="color: #ff0000;">&quot;kr&quot;</span> <span style="color: #0066CC;">language</span>=<span style="color: #ff0000;">&quot;ko&quot;</span> alphabet=<span style="color: #ff0000;">&quot;korean&quot;</span> /&gt;
     &lt;locale country=<span style="color: #ff0000;">&quot;se&quot;</span> <span style="color: #0066CC;">language</span>=<span style="color: #ff0000;">&quot;en&quot;</span> alphabet=<span style="color: #ff0000;">&quot;latin&quot;</span> /&gt;
     &lt;locale country=<span style="color: #ff0000;">&quot;uk&quot;</span> <span style="color: #0066CC;">language</span>=<span style="color: #ff0000;">&quot;en&quot;</span> alphabet=<span style="color: #ff0000;">&quot;latin&quot;</span> /&gt;
     &lt;locale country=<span style="color: #ff0000;">&quot;us&quot;</span> <span style="color: #0066CC;">language</span>=<span style="color: #ff0000;">&quot;en&quot;</span> alphabet=<span style="color: #ff0000;">&quot;latin&quot;</span> /&gt;
&lt;/localeMapping&gt;</pre>
</blockquote>
<p>The alphabet tag is not relative to any specific standard, but just actually the logic part of what I use to load the fonts and the CSS (see <a title="Loading assets dynamically (part 4: fonts and CSS)" href="http://jansensan.net/loading-assets-dynamically-part-4" target="_self">previous post</a>).</p>
<p>So far as the logic goes, once the config file is loaded it is easy to associate a country with a language and load the related files. If a user comes to a website and there a script that detects France, it is then possible to know what to load: the french copy, the latin font set and the latin CSS. Same goes for any country.</p>
<p><a title="Antti Kupila" href="http://www.anttikupila.com/" target="_blank">Antti Kupila</a>, a colleague of mine, believes that it is kind of cheating to reload a a whole website to change the locale. I agreed when he explained how to realize this.</p>
<p>Whenever a TextField is added in the application, it is registered and a reference to it is kept in memory somewhere. When the user changes the locale, there is no need to reload all assets, just the necessary copy, the font set and the CSS (or TextFormat, depending). Once all is loaded, update the TextFields.</p>
<p>Here you go Internets, another way to organize and simplify your life.</p>
]]></content:encoded>
			<wfw:commentRss>http://jansensan.net/locale-mapping/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Loading assets dynamically (part 4: fonts and CSS)</title>
		<link>http://jansensan.net/loading-assets-dynamically-part-4</link>
		<comments>http://jansensan.net/loading-assets-dynamically-part-4#comments</comments>
		<pubDate>Thu, 28 Jan 2010 16:32:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://jansensan.net/?p=110</guid>
		<description><![CDATA[One of the great promises of Flash, back when it was introduced, was that finally designers would not have to worry anymore about the limitation of web fonts. But Flash developers all around had to find different way to use and implement the designers’ choice efficiently.
Lots of websites done with static content or localized only [...]]]></description>
			<content:encoded><![CDATA[<p>One of the great promises of Flash, back when it was introduced, was that finally designers would not have to worry anymore about the limitation of <a href="http://en.wikipedia.org/wiki/Web_typography" target="_blank">web fonts</a>. But Flash developers all around had to find different way to use and implement the designers’ choice efficiently.</p>
<p>Lots of websites done with static content or localized only in one language did not need to worry much about fonts, however as Flash grew in popularity and demand, projects became more complex and required text to be dynamic and localized. That’s when the party started.</p>
<p>What is presented here is a workflow that I have been using with my team for quite some time, and it has proven efficient. I do not dare to say it is the best, especially since dealing with fonts in Flash is such a pain that many people have probably lots of different ways to import and use fonts properly.</p>
<p><strong>Creating a SWF Font File</strong></p>
<p>The idea is to create a SWF file that contains the fonts necessary to the website and pair it with whatever little <a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/text/StyleSheet.html" target="_blank">CSS ActionScript can handle</a>. Lee Brimelow has a great <a href="http://www.gotoandlearn.com/play?id=102" target="_blank">video tutorial</a> on how to create such a SWF. Dominic Gelineau from <a href="http://www.zedia.net/" target="_blank">Zedia Flash Blog</a> also <a href="http://www.zedia.net/2010/fonts-are-my-bane-not-anymore/" target="_blank">posted something quite similar</a> to what I explain here, he just posted before me, while my text was still a draft.</p>
<p>When I was working on a project for a client that needed all sorts of different languages (Chinese,  Japanese, Russian, English, French, etc.), I made different SWF files and named them according to the alphabet they contained:</p>
<ul>
<li>chineseFonts.swf</li>
<li>cyrillicFonts.swf</li>
<li>japaneseFonts.swf</li>
<li>latinFonts.swf</li>
</ul>
<p>Using the unicodeRange parameter is quite interesting, especially for Chinese characters, so you can considerably reduce the size of your embedded font.</p>
<p>I noticed recently with the update to Flash Builder 4 beta 2 that the embedAsCFF parameter was now set to true by default. This is quite annoying, because unless you use the new Flash Player 10 <a href="http://labs.adobe.com/technologies/textlayout/" target="_blank">Text Layout Framework</a>, <a href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/text/FontType.html#EMBEDDED_CFF" target="_blank">text will not render on screen</a>. I now always set the embedAsCFF as false.</p>
<p>In your project, load the SWF file that contains the font just like I explained <a href="http://jansensan.net/loading-assets-dynamically-part-2" target="_self">how to load SWF files whose library contain classes that are meant to be exported for ActionScript</a>. Here as well, the <a href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/system/LoaderContext.html" target="_blank">LoaderContext</a>'s application domain parameter must be set to <a href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/system/ApplicationDomain.html#currentDomain" target="_blank">ApplicationDomain.currentDomain</a> so that the loaded fonts are available to the whole application.</p>
<p>It may be useful to test if the fonts are indeed embedded once the file has loaded. Here is a little function that will trace all embedded fonts in your app:</p>
<p>ActionScript:</p>
<blockquote>
<pre class="actionscript"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> traceEmbeddedFonts<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #ff0000;">&quot;--- traceEmbeddedFonts ---&quot;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> embeddedFonts:<span style="color: #0066CC;">Array</span> = <span style="color: #0066CC;">Font</span>.<span style="color: #006600;">enumerateFonts</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">font</span>:<span style="color: #0066CC;">Font</span>
	<span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>;
	<span style="color: #000000; font-weight: bold;">var</span> numLoops:<span style="color: #0066CC;">int</span> = embeddedFonts.<span style="color: #0066CC;">length</span>;
	<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i; i &amp;lt; numLoops; i++<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">font</span> = embeddedFonts<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;
		<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;[&quot;</span> + i + <span style="color: #ff0000;">&quot;]<span style="color: #000099; font-weight: bold;">\n</span>fontName:&quot;</span> + <span style="color: #0066CC;">font</span>.<span style="color: #006600;">fontName</span> + <span style="color: #ff0000;">&quot;,<span style="color: #000099; font-weight: bold;">\n</span>style: &quot;</span> + <span style="color: #0066CC;">font</span>.<span style="color: #006600;">fontStyle</span> + <span style="color: #ff0000;">&quot;,<span style="color: #000099; font-weight: bold;">\n</span>type: &quot;</span> + <span style="color: #0066CC;">font</span>.<span style="color: #006600;">fontType</span> + <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
</blockquote>
<p>I strongly suggest that developpers always include the font files they use in their assets directory, for it is a great pain to discover that the version of the font used for developement differs than the one we may actually have in hand. Font may have different kerning and leading from version to version, which sometimes leads to completely redoing the design. Keep that in mind people.</p>
<p><strong>Using CSS</strong></p>
<p>Now that we know we have our needed font loaded into our application, let's look at the CSS part of it. Here as well, I named the CSS files according to alphabet, since not all fonts were laid out the same.</p>
<ul>
<li>chineseFonts.css</li>
<li>cyrillicFonts.css</li>
<li>japaneseFonts.css</li>
<li>latinFonts.css</li>
</ul>
<p>In the CSS, I made sure that the font tag would use the font name I gave my font in the SWF file created earlier.</p>
<p>CSS:</p>
<blockquote>
<pre class="css"><span style="color: #6666ff;">.someCSSClass</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span>:<span style="color: #ff0000;">&quot;CustomFontName&quot;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</blockquote>
<p>Once the CSS is loaded into my application, I <a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/text/StyleSheet.html#parseCSS()" target="_blank">convert it to a StyleSheet</a>. Then, I can use it like this:</p>
<p>ActionScript:</p>
<blockquote>
<pre class="actionscript"><span style="color: #000000; font-weight: bold;">var</span> styleSheet:StyleSheet = <span style="color: #000000; font-weight: bold;">new</span> StyleSheet<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
styleSheet.<span style="color: #0066CC;">parseCSS</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span>the-loaded-CSS-goes-here<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> t:<span style="color: #0066CC;">TextField</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
t.<span style="color: #0066CC;">width</span> = <span style="color: #cc66cc;">320</span>;
t.<span style="color: #0066CC;">height</span> = <span style="color: #cc66cc;">240</span>;
t.<span style="color: #0066CC;">embedFonts</span> = <span style="color: #000000; font-weight: bold;">true</span>;
t.<span style="color: #006600;">styleSheet</span> = styleSheet;
t.<span style="color: #0066CC;">htmlText</span> = <span style="color: #ff0000;">&quot;&amp;lt;span class='someCSSClass'&amp;gt;&lt;span class=&quot;</span>customCSSClass<span style="color: #ff0000;">&quot;&gt;Some text goes here&amp;lt;/span&amp;gt;&lt;/span&gt;&quot;</span>;</pre>
</blockquote>
<p>I believe in using CSS rather than AS3's native <a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/text/TextFormat.html" target="_blank">TextFormat</a> for it is possible to change the text layout without having to recompile the application every time. Do make sure to check what tags are actually supported as it is quite limited.</p>
<p><strong>Pixel Fonts</strong></p>
<p>I recently created a game in which I wanted to make sure I could use pixels, which</p>
<p>meant I needed a pixel font. After looking googling and reading many blogs and tutorials, it became clear that Lee’s technique would not be useful this time, since there was no way to choose bitmap when embedding the font.</p>
<p>Instead, I found a workaround that did just the trick. In the Flash IDE, I created a symbol, which I named BitmapTextFieldAsset and gave it the exact same class name. In that symbol, I created a textfield into which I embedded the whole bitmap font like we did back when sites could be static. I then created a class that would be the one I used as a textfield whenever I needed the bitmap font in the game, and voilà! A dynamic custom textfield class that would use a Bitmap font. CSS does work as well in this case.</p>
<p><strong>Conclusion</strong></p>
<p>It would be presomptuous from me so say I covered all there is to say about fonts and CSS in Flash, but I do believe that in a nutshell, this workflow is efficient.</p>
<p>What say you?</p>
]]></content:encoded>
			<wfw:commentRss>http://jansensan.net/loading-assets-dynamically-part-4/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using a gamepad to interact with Flash</title>
		<link>http://jansensan.net/using-a-gamepad-to-interact-with-flash</link>
		<comments>http://jansensan.net/using-a-gamepad-to-interact-with-flash#comments</comments>
		<pubDate>Mon, 12 Oct 2009 17:09:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Games]]></category>

		<guid isPermaLink="false">http://jansensan.net/?p=107</guid>
		<description><![CDATA[Although its performance is still not at its best, Flash has a bright future in gaming, simply look at how many MMORPGs are made in flash and how many websites host games. With Flash soon to support multitouch events and also soon being ported to the iPhone and I think we will see more games [...]]]></description>
			<content:encoded><![CDATA[<p>Although its performance is still not at its best, Flash has a bright future in gaming, simply look at how many MMORPGs are made in flash and how many websites host games. With Flash soon to support multitouch events and also soon being ported to the iPhone and I think we will see more games made with the platform.</p>
<p>Time and again I have read articles by people complaining that Flash does not support gamepads. I think I understand Adobe for not wanting to spend time creating more preferences windows and other sorts of open doors into the Flash Player. Be that as it may, I may have found an interesting solution which makes using a gamepad ot interact with Flash possible.</p>
<p>A year ago or so, I switched to Mac, I bought a MacBook Pro. My old PC tower was moved to my living room to replace the previous one. That tower is basically my media station from which I play movies, music and games onto my television.</p>
<p>I do not own an Xbox but I stil am very interested in some games like <a href="http://braid-game.com/" target="_blank">Braid</a> and <a href="http://www.dpadstudio.com/default.asp?template=project&amp;id=2" target="_blank">OwlBoy</a>, I thought it would be perfect to use my gamepad and not my keyboard to play those games. Braid did not support <a href="http://www.logitech.com/index.cfm/gaming/controllers/devices/287" target="_blank">my gamepad</a> and I was not about to purchase another $50 gamepad for a $15 game. It also turns out that my graphic card is not good enough for the game either. And Owlboy is not out yet. But I digress...</p>
<p>I was browsing Google for options when I found a nice little utility tool: <a href="http://www.electracode.com/4/joy2key/JoyToKey%20English%20Version.htm" target="_blank">JoyToKey</a>. It allows you to map any key and mouse command to any button of your gamepad. It works like a charm, my gamepad is now my controller for WinAmp.</p>
<p>And this got me wondering. I currently am working on a hommage game to NES era games (more on that eventually) and I was hoping I could use a gamepad to play rather than my keyboard. I'm developping on a Mac. Google to the rescue again, the equivalent to JoyToKey on a Mac is the <a href="http://www.carvware.com/gamepadcompanion.html" target="_blank">GamePad Companion</a>. It essentially does the same thing.</p>
<p>So here is my suggestion. Whenever you make a game that you think is better played on a gamepad, do not hesitate. Offer the links to those utilities to your users, have a simple tutorial on how to use those items and maybe explain to them why you have to go this route, since not every one understands that Flash is limited in accessing devices.</p>
<p>Links:</p>
<ul>
<li>Windows: <a href="http://www.electracode.com/4/joy2key/JoyToKey%20English%20Version.htm" target="_blank">JoyToKey</a></li>
<li>Mac OSX: <a href="http://www.carvware.com/gamepadcompanion.html" target="_blank">GamePad Companion</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://jansensan.net/using-a-gamepad-to-interact-with-flash/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
