<?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>noCreativity.com &#187; Actionscript</title>
	<atom:link href="http://nocreativity.com/blog/category/actionscript/feed" rel="self" type="application/rss+xml" />
	<link>http://nocreativity.com</link>
	<description>The life and discoveries of a new media artist</description>
	<lastBuildDate>Sat, 07 Jan 2012 17:03:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Hello Preso!</title>
		<link>http://nocreativity.com/blog/hello-preso</link>
		<comments>http://nocreativity.com/blog/hello-preso#comments</comments>
		<pubDate>Fri, 06 May 2011 16:24:04 +0000</pubDate>
		<dc:creator>Ronny</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Red5]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[chat]]></category>
		<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[Multi-user]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[Preso]]></category>
		<category><![CDATA[Project]]></category>
		<category><![CDATA[realtime]]></category>
		<category><![CDATA[webcam]]></category>

		<guid isPermaLink="false">http://nocreativity.com/blog/?p=1242</guid>
		<description><![CDATA[I have worked on this about a year ago. I made this as a project for an exam. Afterwards I felt it wasn&#8217;t finished yet so I decided to work on it someday again&#8230; This has been on my todo-list for several months now and a few weeks ago I decided to get it over [...]]]></description>
			<content:encoded><![CDATA[<p>I have worked on this about a year ago. I made this as a project for an exam. Afterwards I felt it wasn&#8217;t finished yet so I decided to work on it <em>someday</em> again&#8230; This has been on my todo-list for several months now and a few weeks ago I decided to get it over with.</p>
<p>Anyway, the point: This is <a href="http://preso.nocreativity.com" target="_blank">Preso</a>! It&#8217;s kind of an Adobe Connect clone, built with Flex 4 and <a href="http://www.red5.org/" target="_blank" target="_blank">Red5</a>. It allows you to have a presentation online.<br />
You start a room, upload some images (that go with your presentation), start the webcam/audio stream and share the direct link with your friends or your audience and go! Here&#8217;s a little demo that should give you an idea.</p>
<p><object width="581" height="363" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=23371663&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=d6d6d6&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed width="581" height="363" type="application/x-shockwave-flash" src="http://vimeo.com/moogaloop.swf?clip_id=23371663&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=d6d6d6&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" allowfullscreen="true" allowscriptaccess="always" /></object></p>
<p>Feel free to <a href="http://preso.nocreativity.com" target="_blank">check it out</a>! Let me know what you think of it!</p>
]]></content:encoded>
			<wfw:commentRss>http://nocreativity.com/blog/hello-preso/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Spread the word, an iPad app built in Flash!</title>
		<link>http://nocreativity.com/blog/spread-the-word-an-ipad-app-built-in-flash</link>
		<comments>http://nocreativity.com/blog/spread-the-word-an-ipad-app-built-in-flash#comments</comments>
		<pubDate>Wed, 01 Sep 2010 16:35:28 +0000</pubDate>
		<dc:creator>Ronny</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Red5]]></category>
		<category><![CDATA[3.3.1]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[cydia]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[jailbroken]]></category>
		<category><![CDATA[spread the word]]></category>
		<category><![CDATA[spread the word for ipad]]></category>

		<guid isPermaLink="false">http://nocreativity.com/blog/?p=1098</guid>
		<description><![CDATA[Near the end of June, I started a little experiment, just for fun, which would just immitate fridge magnets. I wanted to make it a multi-user experience. So everybody hitting the page would see the changes that are being made realtime. I built the first version and was quite happy. But a few days ago, it [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://spreadtheword.nocreativity.com"><img class="alignnone size-full wp-image-1099" title="spreadTheWord" src="http://nocreativity.com/blog-engine/wp-content/uploads/2010/09/spreadTheWord.jpg" alt="" width="580" height="280" /></a></p>
<p>Near the end of June, I started a little experiment, just for fun, which would just immitate fridge magnets. I wanted to make it a multi-user experience. So everybody hitting the page would see the changes that are being made realtime. I built the first version and was quite happy.</p>
<p>But a few days ago, it struck me: I can just use the code I used for that experiment and port it to the iPad using the iPhone Packager (which comes with Flash CS5). So I did!</p>
<p>Although I had to change some of the code (loading settings files, etc), I was actually able to build this application rather quickly. I also added a multi-room feature, so everybody can have their own <em>fridge</em> with magnets <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
So you can now actually leave your boy/girlfriend a message on a virtual <em>fridge </em>(with no food in it) and then mail him/her the link! He/She can then rearrange the letters and leave you a message in return; Fridge-magnet style! That&#8217;s geeky, right!? <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
<h3>About the application</h3>
<p>&#8216;Spread the word&#8217; is both an iPad and a browser application.<br />
The clients are built using Flash Builder (for the browser app) and Flash CS5 (iPad app). The multi-user support is a Red5 application.</p>
<h3><strong>&#8216;Spread the word&#8217; online</strong></h3>
<p>You can view the application in the browser by hitting the following URL:</p>
<p><a href="http://spreadtheword.nocreativity.com" target="_blank">http://spreadtheword.nocreativity.com</a></p>
<p>If you want to have your own <em>fridge</em>, just add &#8216;?myOwnFridge&#8217; (replace &#8216;<em>myOwnFridge</em>&#8216; with a name of your choice). For example</p>
<ul>
<li><a href="http://spreadtheword.nocreativity.com?test" target="_blank">http://spreadtheword.nocreativity.com?test</a></li>
<li><a href="http://spreadtheword.nocreativity.com?mySecretRoom" target="_blank" target="_blank">http://spreadtheword.nocreativity.com?mySecretRoom</a></li>
<li><a href="http://spreadtheword.nocreativity.com?imOnAHorse" target="_blank" target="_blank">http://spreadtheword.nocreativity.com?imOnAHorse</a></li>
</ul>
<h3>&#8216;Spread the word&#8217; for iPad</h3>
<p>Currently the iPad application is only available though my Cydia repo. I will however be trying to get it into the Apple App Store (I know about <a href="http://nocreativity.com/blog/section-3-3-1-fuck-off-devs" target="_blank">3.3.1</a>, I&#8217;m still giving it a shot <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' />  ). The app also supports rooms, so feel free to go crazy (but be nice, there&#8217;s kids on the internet <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )<span id="more-1098"></span></p>
<p>If you want to install the iPad application you need a jailbroken iPad. If you haven&#8217;t added my repository to your Cydia sources yet, follow these instructions:</p>
<ol>
<li>Open Cydia on your jailbroken iPad</li>
<li>Go to the &#8216;Manage&#8217; tab</li>
<li>Tap &#8216;Sources&#8217;</li>
<li>Tap &#8216;Edit&#8217; in the upper right corner</li>
<li>Tap &#8216;Add&#8217; in the upper left corner</li>
<li>Fill in the following URL: &#8216;http://nocreativity.com/cydia&#8217;</li>
<li>Tap &#8216;Add source&#8217;</li>
<li>You&#8217;re done!</li>
</ol>
<p>To install Spread The Word for iPad, do this:</p>
<ol>
<li>Open Cydia on your jailbroken iPad</li>
<li>Go to the &#8216;Sections&#8217; tab</li>
<li>Find the &#8216;noCreativity&#8217; section</li>
<li>Tap on the application (there&#8217;s only one in that list right now, so you can&#8217;t do anything wrong from this point on <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )</li>
<li>Tap &#8216;install&#8217; in the upper right corner</li>
<li>Tap &#8216;Confirm&#8217; in the upper right corner</li>
<li>When the installation is done, exit Cydia. Spread the word should be installed now. Have fun!</li>
</ol>
<h3>Credits</h3>
<p>Eventhough I created this app myself, I owe a big thank you to <a href="http://www.etsy.com/shop/evgie" target="_blank" target="_blank">Eugenia Furman</a> for letting me use her beautiful letters. Those are actually real letters, which she created herself. They&#8217;re for sale on Etsy. They&#8217;re really awesome. Make sure you go and check out <a href="http://www.etsy.com/shop/evgie" target="_blank" target="_blank">her other work</a>. I totally love it!<strong></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://nocreativity.com/blog/spread-the-word-an-ipad-app-built-in-flash/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Particle power!</title>
		<link>http://nocreativity.com/blog/particle-power</link>
		<comments>http://nocreativity.com/blog/particle-power#comments</comments>
		<pubDate>Mon, 05 Apr 2010 11:44:36 +0000</pubDate>
		<dc:creator>Ronny</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Open-source]]></category>
		<category><![CDATA[Actionscript3]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[FITC]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[letitbloom]]></category>
		<category><![CDATA[particles]]></category>
		<category><![CDATA[ralph hauwert]]></category>

		<guid isPermaLink="false">http://nocreativity.com/blog/?p=948</guid>
		<description><![CDATA[Ever since Ralph Hauwert first announced his part of the LetItBloom site, I kinda wondered how he did it. V1 A few weeks ago, in Amsterdam, Ralph explained a bit about it during his session. And then finally yesterday (actually the day before&#8230;), I bit the bullet and spent the evening making it happen. Only [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since <a href="http://unitzeroone.com" target="_blank" target="_blank">Ralph Hauwert</a> first announced <a href="http://www.letitbloom.com/#ralph" target="_blank" target="_blank">his part</a> of the <a href="http://letitbloom.com" target="_blank" target="_blank">LetItBloom</a> site, I kinda wondered how he did it.</p>
<p><a href="http://www.letitbloom.com/#ralph" target="_blank" target="_blank"><img class="alignnone size-full wp-image-949" title="Ralph Hauwert's LetItBloom part (preview)" src="http://nocreativity.com/blog-engine/wp-content/uploads/2010/04/bloom.jpg" alt="" width="580" height="361" /></a></p>
<h3><strong>V1</strong></h3>
<p>A few weeks ago, in Amsterdam, Ralph explained a bit about it during his session. And then finally yesterday (actually the day before&#8230;), I bit the bullet and spent the evening making it happen. Only 4 hours later I had a first version that got pretty close to it.</p>
<p><a href="http://labs.nocreativity.com/particles/one/?inspired%20by%20Ralph%20Hauwert" target="_blank"><img class="alignnone size-full wp-image-950" title="Particle testing - Part one (no blur preview)" src="http://nocreativity.com/blog-engine/wp-content/uploads/2010/04/particleFun_V1.jpg" alt="" width="580" height="266" /></a></p>
<p>Check this very first edition on the following URLs. The text is generated using AS3, so you can just make it show any text you want. Just change the URL params <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<ul>
<li><a href="http://labs.nocreativity.com/particles/one/?inspired%20by%20Ralph%20Hauwert" target="_blank">Particle fun V1 (with blur)</a></li>
<li><a href="http://labs.nocreativity.com/particles/one/noblur/?inspired%20by%20Ralph%20Hauwert" target="_blank">Particle fun V1 (without blur)</a></li>
</ul>
<p>The particles move to a perlin-map (red &amp; green) with text in front of it. The color of each pixel is used to determine whether the particles has to move up,down,left or right and how far. Not how fast&#8230; That left all particles moving almost equally fast&#8230; Which is kind of a minor downside to me&#8230; Seeing how it almost was 6AM, I felt it were a good idea to catch some sleep&#8230;<span id="more-948"></span></p>
<h3><strong>V2</strong></h3>
<p>When I woke up a few hours later, I felt the irresistible need to improve the effect of the particle swarms and optimize some code in order to squeeze a few more frames per second out of the code.</p>
<p><a href="http://labs.nocreativity.com/particles/two/?OMGWTFBBQ%20particles%20rock!" target="_blank"><img class="alignnone size-full wp-image-951" title="Particle Fun V2" src="http://nocreativity.com/blog-engine/wp-content/uploads/2010/04/particleFun_v2.jpg" alt="" width="580" height="269" /></a></p>
<p>I ruined the rest of my day coming up with another version. This time the perlin-map&#8217;s color would not just serve as a guide who tells the particles where to go and how far. The map would actually act as a force field: Each pixel would accelerate the particles on both the x and y-axis. As a result: we have now very different speeds of particles! And it looks pretty cool too! Example below. The text can be controlled using the URL parameters.</p>
<ul>
<li><a href="http://labs.nocreativity.com/particles/two/?OMGWTFBBQ%20particles%20rock!" target="_blank">Particle fun V2 </a></li>
</ul>
<p><strong>Watch out! Nerd time!</strong></p>
<p>This final version (well&#8230; final&#8230;) looks pretty good in my opinion. A few details about it:</p>
<ul>
<li>25000 particles (1 particle = 1 pixel)</li>
<li>runs up to 85fps (Capped this at 50fps, otherwise it the animation would be too wild)</li>
<li>The bitmapdata object&#8217;s dimensions: 750 x 350</li>
</ul>
<p><strong>Most important things</strong></p>
<p>During this experiment I learned a lot about optimization. A few things that might come in handy some time:</p>
<ul>
<li>Instead of using setPixel() for every single pixel you wish to animate, only update the bitmapdata once using setVector(). You can get the vector of pixelvalues from the bitmapdata obj using getVector(). Then change the values in the vector. When done, appy the new values to the bitmapdata object using setVector(). This will give you some valuable milliseconds (believe me: every millisecond counts when doing 25 000 loops per frame)</li>
<li>Instead of looping through long arrays  (or even vectors) use <a href="http://blog.open-design.be/2009/01/04/as3-arrays-against-linked-lists-performance-benchmarking/" target="_blank" target="_blank">linked lists</a>: They&#8217;re easy and fast!</li>
<li>Bitwise operations might look very unhuman, but they can buy you a great deal of milliseconds! Make sure you check the bitwise possibilities that there are out there. A lot of great minds have shared &#8216;common&#8217; calculations in the form of bitwise operations that turn out to be just a bit faster.</li>
<li>Think a <strong>lot</strong> about what kind of calculations you&#8217;re going to make and most importantly: When? For example in my first version: I get the pixelvalue from the perlinmap every iteration of the loop (times 25 000). However in version 2, after generating the perlin map, I immediately calculated the forces of every pixel and saved the values in a vector. I then request those values in the loops. This kind of precalculations will give you valuable milliseconds per frame and thus more fps.</li>
<li>When editing pixel per pixel, make sure to lock()/unlock() your bitmapdata. That will prevent the bitmap from updating after every change. Again: giving you more milliseconds for your viewing pleasure!</li>
</ul>
<p>I can&#8217;t really post any technical optimization tips (since I really just got started myself) but there are tons of articles out there on this topic. I suggest you check those out for more practical optimization tips.</p>
<p>I&#8217;m looking into doing more experimentation regarding particles. If you have any optimization techniques that I should know off, don&#8217;t hold back to educate me <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Either way: I really love this, so stay tuned!</p>
<p><strong>Sources</strong>: <a href="http://nocreativity.com/blog-engine/wp-content/plugins/download-monitor/download.php?id=7" title="ParticleLab - Downloaded 320 times">Click</a> (Flash Builder 4 project)</p>
]]></content:encoded>
			<wfw:commentRss>http://nocreativity.com/blog/particle-power/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Fixing the NetStatusEvent.info.code ugliness in Actionscript 3</title>
		<link>http://nocreativity.com/blog/fixing-the-netstatusevent-info-code-ugliness-in-actionscript-3</link>
		<comments>http://nocreativity.com/blog/fixing-the-netstatusevent-info-code-ugliness-in-actionscript-3#comments</comments>
		<pubDate>Sun, 21 Mar 2010 14:06:42 +0000</pubDate>
		<dc:creator>Ronny</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Actionscript3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[NetStatusEvent]]></category>

		<guid isPermaLink="false">http://nocreativity.com/blog/?p=921</guid>
		<description><![CDATA[Everything in AS3 is pretty straight forward once you get your head around it but the guys at Adobe seem to have become sloppy when they wrote the NetstatusEvent structure. Ever since I got started with Red5, remote shared objects and all kind of different remote animals about 3 years ago, I ran into this [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-931 alignleft" title="Actionscript " src="http://nocreativity.com/blog-engine/wp-content/uploads/2010/03/Picture-1041.jpg" alt="" width="178" height="151" />Everything in AS3 is pretty straight forward once you get your head around it but the guys at Adobe seem to have become sloppy when they wrote the NetstatusEvent structure.<br />
Ever since I got started with Red5, remote shared objects and all kind of different remote animals about 3 years ago, I ran into this ugly &#8216;<em>NetstatusEvent.info.code</em>&#8216; thing which is basically just a string. In order to know which one it is you have to use a switch statement to figure this out using real strings (instead of class constants) (which looks like the following).</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onNetStatus<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">NetStatusEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">switch</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">info</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">code</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">case</span><span style="color: #990000;">&quot;Netconnection.Connect.Success&quot;</span><span style="color: #000066; font-weight: bold;">:</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;You connected!&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">case</span> <span style="color: #990000;">&quot;Netconnection.Connect.Closed&quot;</span><span style="color: #000066; font-weight: bold;">:</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;You disconnected!&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>As a very lazy developer, I tend to think that comparing strings like this is just crazy. And ugly! So I made my life just a little better by creating my own class that holds &#8216;<em>InfoObjects</em>&#8216; with the &#8216;<em>code</em>&#8216;, &#8216;<em>level</em>&#8216; and &#8216;<em>meaning</em>&#8216; properties. That way you can just compare the &#8216;<em>event.code.info&#8217;</em> to a class constant. No need for copy-pasting codes from <a href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/events/NetStatusEvent.html#info" target="_blank" target="_blank">the Adobe site</a>, or debugging your code in order to find you made a typo in one of those strings&#8230;</p>
<p>I ran <a href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/events/NetStatusEvent.html#info" target="_blank" target="_blank">the table</a> (listing all of the <em>NetStatus codes</em>) through <a href="http://shots.nocreativity.com/6eb07dee166bcf61acea0ae6413d5fb7.jpg" target="_blank">a simple XML parser</a> and ended up with a very neat Actionscript class (which I&#8217;m sharing, so it&#8217;s up for grabs! Download link at the end of this blogpost!). Using it looks way more natural!</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onNetStatus<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">NetStatusEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">switch</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">info</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">code</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">case</span> NetStatusInfo<span style="color: #000066; font-weight: bold;">.</span>NETCONNECTION_CONNECT_SUCCESS<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">code</span><span style="color: #000066; font-weight: bold;">:</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;You connected!&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">// returns the code property (same as 'toString()')</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>NetStatusInfo<span style="color: #000066; font-weight: bold;">.</span>NETCONNECTION_CONNECT_SUCCESS<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">code</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> 
&nbsp;
			<span style="color: #009900; font-style: italic;">// returns the level property</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>NetStatusInfo<span style="color: #000066; font-weight: bold;">.</span>NETCONNECTION_CONNECT_SUCCESS<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">level</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> 
&nbsp;
			 <span style="color: #009900; font-style: italic;">// returns the meaning of this status change</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>NetStatusInfo<span style="color: #000066; font-weight: bold;">.</span>NETCONNECTION_CONNECT_SUCCESS<span style="color: #000066; font-weight: bold;">.</span>meaning<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">case</span> NetStatusInfo<span style="color: #000066; font-weight: bold;">.</span>NETCONNECTION_CONNECT_CLOSED<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">code</span><span style="color: #000066; font-weight: bold;">:</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;You disconnected!&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<h2>However&#8230;.</h2>
<p>Why isn&#8217;t this just event based? Right now the <em>Netconnection</em> dispatches a <em>NetStatusEvent.NET_STATUS</em>. Most people find this very acceptable. I, myself, tend to think it&#8217;s funny. The classname (<em>NetStatusEvent</em>) is pretty darn clear about the fact that the event triggered is related to the netstatus&#8230; Duh?!<br />
Anyway: after having listened to that event and having caught it, we now need to evaluate the <em>event.info.code</em> property (which will return a string like &#8216;<em>NetConnection.Connect.Success</em>&#8216;)&#8230; Why is that??<br />
Why not just dispatch <em>NetStatusEvent.NETCONNECTION_CONNECT_SUCCESS</em>? Wouldn&#8217;t this be more consistent with the rest of Actionscript?</p>
<p>It would only make life better:</p>
<ol>
<li>No more copy-pasting of &#8216;<em>codes</em>&#8216;. They&#8217;re just constants in the <em>NetStatusEvent</em> class.</li>
<li>No chance of runtime bugs because of typo&#8217;s made in the string itself. The use of constants makes sure the compiler knows when you&#8217;re doing something horrible, and allows him to throw that error right in your face!</li>
<li>Auto-completion! Because life should be made easier by computers; not harder!</li>
</ol>
<p>I think that an implementation like mentioned above would be pretty cool (and perhaps more logical). At least to me&#8230;</p>
<h2>Download</h2>
<p>Feel free to use, modify, marry this class (and pass it on onto your children) if needed. If I overlooked anything or there&#8217;s a better way of doing this, feel free to ping me and I shall correct myself asap!</p>
<p>Enjoy!</p>
<p><strong>Download</strong>: <a href="http://nocreativity.com/blog-engine/wp-content/plugins/download-monitor/download.php?id=6" title="NetStatusInfo class - Downloaded 365 times">Click</a></p>
]]></content:encoded>
			<wfw:commentRss>http://nocreativity.com/blog/fixing-the-netstatusevent-info-code-ugliness-in-actionscript-3/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Open Microphone pt 1</title>
		<link>http://nocreativity.com/blog/open-microphone-pt-1</link>
		<comments>http://nocreativity.com/blog/open-microphone-pt-1#comments</comments>
		<pubDate>Fri, 25 Sep 2009 14:10:04 +0000</pubDate>
		<dc:creator>Ronny</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[getMicrophone]]></category>
		<category><![CDATA[mic]]></category>
		<category><![CDATA[microphone]]></category>
		<category><![CDATA[mikerophone]]></category>
		<category><![CDATA[SoundAnalyzing]]></category>
		<category><![CDATA[SoundSpectrum]]></category>

		<guid isPermaLink="false">http://nocreativity.com/blog/?p=669</guid>
		<description><![CDATA[If you&#8217;ve come by here a few times you know I have been experimenting with computeSpectrum and webcam motion detection. At a given moment I wanted to combine the 2 of them in order to use voice commands in order to make stuff happen on the screen. That would be pretty badass, right? However I [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-670 alignleft" title="mikerophone" src="http://nocreativity.com/blog-engine/wp-content/uploads/2009/09/mikerophone.jpg" alt="mikerophone" width="220" height="239" />If you&#8217;ve come by here a few times you know I have been experimenting with computeSpectrum and webcam motion detection. At a given moment I wanted to combine the 2 of them in order to use voice commands in order to make stuff happen on the screen. That would be pretty badass, right?</p>
<p>However I soon learned the microphone feed didn&#8217;t go through the SoundMixer of the Flash Player, therefor would would not be able to be analyzed. There was a workaround with FMS/RED5 and bouncing the stream off the server but that&#8217;s rather overkill (not to mention the lag). <span id="more-669"></span></p>
<p><strong>However&#8230;<br />
</strong>Mike Chambers and Lee Brimelow were in Paris the other day where they demoed/demo&#8217;ed/demo-ed (how the hell do you spell that word??) a few new features of the upcoming AIR release. If you don&#8217;t already know, you&#8217;ll probably have guessed it by now but (just to be crystal clear): The microphone is accesible for computeSpectrum in the AIR runtime. Check out <a href="http://theflashblog.com/?p=1426" target="_blank" target="_blank">the demo</a> on Lee&#8217;s blog <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Lee stated on his blog he couldn&#8217;t talk about this feature being brought to the Flash Player, but I&#8217;m pretty confident Adobe will do so <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Even though I&#8217;m not much of an AIR developer, I like the idea of having access to both microphone and camera&#8230; I can image a few cool applications using those features&#8230; <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
<p>By the way: If you don&#8217;t already know: there&#8217;s a great site with all kinds of intresting articles on the subject. If you&#8217;re interested, make sure to check it out: <a href="http://www.getmicrophone.com/" target="_blank" target="_blank">getMicrophone()</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nocreativity.com/blog/open-microphone-pt-1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bezier animation fun revisited</title>
		<link>http://nocreativity.com/blog/bezier-animation-fun-revisited</link>
		<comments>http://nocreativity.com/blog/bezier-animation-fun-revisited#comments</comments>
		<pubDate>Mon, 07 Sep 2009 22:17:36 +0000</pubDate>
		<dc:creator>Ronny</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Open-source]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Bezier]]></category>
		<category><![CDATA[BezierAnimation]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://nocreativity.com/blog/?p=600</guid>
		<description><![CDATA[A few months ago I experimented with Bezier Animation and allthough I uploaded my SWF files and shared them, I never really shared the source. This is what I wanted to do a few days ago when I thought &#8220;Oh, what the hell&#8230; Let&#8217;s clean that code up before uploading it&#8230;&#8221;. So I started moving [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago <a href="http://nocreativity.com/blog/bezier-animation-fun" target="_blank">I experimented</a> with Bezier Animation and allthough I uploaded my SWF files and shared them, I never <span style="text-decoration: line-through;">really</span> shared the source. This is what I wanted to do a few days ago when I thought &#8220;Oh, what the hell&#8230; Let&#8217;s clean that code up before uploading it&#8230;&#8221;.</p>
<p>So I started moving some code around and after a few minutes, I found myself rewriting the whole thing&#8230; That&#8217;s not a bad thing since now we&#8217;ve got one handy class that can do about just everything a Bezier Animator should be able to do. <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
<a href="http://labs.nocreativity.com/bezier/BezierAnimationDemo.html"rel="shadowbox;width=900;height=450" >Demo time</a>!</p>
<p style="text-align: center;"><a href="http://labs.nocreativity.com/bezier/BezierAnimationDemo.html"rel="shadowbox;width=900;height=450" ><img class="size-full wp-image-601 aligncenter" title="Bezier Animation Demo" src="http://nocreativity.com/blog-engine/wp-content/uploads/2009/09/screenshot-2009-09-07-at-23.38.10.JPG" alt="Bezier Animation Demo" width="559" height="262" /></a></p>
<p style="text-align: left;">There&#8217;s still a little bug somewhere which allows the target to &#8216;run away&#8217; from the bezier, and I haven&#8217;t gotten quite to the root of the problem, but I really felt I had to share this. Also there are some imperfections when you disable the orientToPath and scaleByPath properties. I will look into fixing those asap.</p>
<p style="text-align: left;">I really love the idea of animation movieclips using bezier curves. It looks so natural and yet zo intriguing&#8230; I will do some experiments and upload them later on, showing the coolness behind this simple animation engine.</p>
<p><strong>Sources<br />
</strong>Download the above demo source (Flash Builder 4 project): <a href="http://nocreativity.com/blog-engine/wp-content/plugins/download-monitor/download.php?id=2" title="BezierAnimation Demo Sources - Downloaded 387 times">Click</a><br />
Download the BezierAnimatioin class: <a href="http://nocreativity.com/blog-engine/wp-content/plugins/download-monitor/download.php?id=3" title="BezierAnimation class - Downloaded 419 times">Click</a></p>
<p><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://nocreativity.com/blog/bezier-animation-fun-revisited/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bezier animation fun!</title>
		<link>http://nocreativity.com/blog/bezier-animation-fun</link>
		<comments>http://nocreativity.com/blog/bezier-animation-fun#comments</comments>
		<pubDate>Tue, 03 Mar 2009 08:21:58 +0000</pubDate>
		<dc:creator>Ronny</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Bezier]]></category>
		<category><![CDATA[Cool shit]]></category>
		<category><![CDATA[FITC]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://nocreativity.com/blog/?p=420</guid>
		<description><![CDATA[Last week I went to FITC in Amsterdam. It was great! I had such a great time. I met a lot of intresting people and although Amsterdam turned out to be quite expensive place, I really liked being there a few days. During the conference I attended Joshua Davis&#8216; session which really inspired me. I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I went to <a href="http://fitc.ca/amsterdam" target="_blank" target="_blank">FITC</a> in Amsterdam. It was great! I had such a great time. I met a lot of intresting people and although Amsterdam turned out to be quite expensive place, I really liked being there a few days.</p>
<p>During the conference I attended <a href="http://www.joshuadavis.com/" target="_blank" target="_blank">Joshua Davis</a>&#8216; session which really inspired me. I&#8217;ve never seen Joshua Davis present, nor did I know his work. Let me be as crystal clear about this as I can be: The man is a freakin&#8217; genius!<br />
During his session he showed a few demo&#8217;s of bezier animated stuff. I felt like trying that myself, and this is what I came up with.</p>
<p style="text-align: center;"><a href="http://www.flickr.com/photos/babycreative/3320561519/" target="_blank"><img class="aligncenter" title="Magic Bezier" src="http://farm4.static.flickr.com/3551/3320561519_4a59409385_o.jpg" alt="" width="492" height="392" /></a></p>
<p>The basic concept is to create a bezier in Actionscript and animating movieclips using the bezier as its motion path.</p>
<ul>
<li><a href="http://labs.nocreativity.com/bezier/pentool.swf"rel="shadowbox;width=700;height=300"  target="_blank">Basic principle</a> (this is actually just a basic pentool (without the option of adding new points <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' />  ))</li>
</ul>
<p>The following versions use the same concept as this one, except instead of fixed anchor points, they all use random points defined in 2 planes. This makes a bit of variety possible allthough the main animation stays the same and that&#8217;s absolutely cool!</p>
<ul>
<li><a href="http://labs.nocreativity.com/bezier/bezierstuff_multiobject.swf"rel="shadowbox;width=800;height=800"  target="_blank">Animation fun</a></li>
<li><a href="http://labs.nocreativity.com/bezier/bezierstuff_multiobject_v2.swf"rel="shadowbox;width=800;height=800"  target="_blank">Animation fun V2</a></li>
</ul>
<p>I added a few keyboard controls to give you some control of what is happening</p>
<ul>
<li>spacebar = show the handles</li>
<li>r = clear the bitmap</li>
<li>p = pause the animation</li>
<li>n = randomize handles</li>
<li>b = blur more</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://nocreativity.com/blog/bezier-animation-fun/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>World360: Unbugged and kicking!</title>
		<link>http://nocreativity.com/blog/world360-unbugged-and-kicking</link>
		<comments>http://nocreativity.com/blog/world360-unbugged-and-kicking#comments</comments>
		<pubDate>Fri, 20 Feb 2009 11:11:29 +0000</pubDate>
		<dc:creator>Ronny</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Bitmapdata]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[prerendering]]></category>
		<category><![CDATA[Stereographic projection]]></category>
		<category><![CDATA[World360]]></category>

		<guid isPermaLink="false">http://nocreativity.com/blog/?p=397</guid>
		<description><![CDATA[A few days back, I posted the latest update on my World360 project (aka &#8216;stereographic projection&#8216;&#8230; That&#8217;s what it is actually called). What this thing actually does is it turns a 360° panorama image into a stereographic projection. The idea is to render this real time (just for the fun of doing it) (I am [...]]]></description>
			<content:encoded><![CDATA[<p>A few days back, I <a href="http://nocreativity.com/blog/world360-update-now-with-png-bug">posted</a> the latest update on my World360 project (aka &#8216;<a href="http://www2.flickr.com/photos/sbprzd/sets/72057594122346154/" target="_blank" target="_blank">stereographic projection</a>&#8216;&#8230; That&#8217;s what it is actually called). What this thing actually does is it turns a 360° panorama image into a stereographic projection. The idea is to render this real time (just for the fun of doing it) (I am thinking about doing more with this though&#8230;)</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-398" title="stereographicprojection" src="http://nocreativity.com/blog-engine/wp-content/uploads/2009/02/stereographicprojection.jpg" alt="stereographicprojection" width="461" height="258" /></p>
<p>A few days back I ran into a (at that time) weird problem where transparency was rendered black after a few frames. I had a hard time figuring out what was going on, and I just didn&#8217;t have a clue where to start looking. Google wasn&#8217;t really helping me out either. So I posted my problem on FlashFocus but nobody came up with the answer to my problem. <a href="http://Peterelst.com" target="_blank" target="_blank">Peter Elst</a> <a href="http://twitter.com/peterelst/status/1210737946" target="_blank" target="_blank">asked</a> <a href="http://www.unitzeroone.com/blog/" target="_blank" target="_blank">Ralph Hauwert</a> if he already had run into this problem. <a href="http://quasimondo.com/" target="_blank" target="_blank">Mario Klingemann</a> <a href="http://twitter.com/Quasimondo/status/1210859471" target="_blank" target="_blank">suggested</a> that there might be a problem with the <a href="http://www.quasimondo.com/archives/000665.php" target="_blank">premultiplied alpha</a>. At that time I didn&#8217;t know what premultiplied alpha was and seen as the problem resembled <a href="http://www.quasimondo.com/premultipliedAlpha/" target="_blank" target="_blank">the example</a> Mario gave, it seemed quite obvious he was right.</p>
<p>So I took peace with this, and decided to fall back to a non-transparent image format like JPEG. 2 days later <a href="http://twitter.com/erwinverdonk" target="_blank" target="_blank">Erwin Verdonk</a> came up with <a href="http://nocreativity.com/blog/world360-update-now-with-png-bug#comment-4135" target="_self">the answer</a> to the whole problem&#8230; I just had a hard time understanding it&#8230;</p>
<p>The root of the problem was me: I had totally forgotten that the draw() method of the BitmapData class didn&#8217;t clear the pixels before drawing&#8230; Yea, that&#8217;s emberassing, right?</p>
<p>But okay&#8230; That took care of some problems. I rewrote some of the code, and adjusted some settings.<br />
The speed and the result are quite okay right now. However using 450MB and up of RAM usage might be a bit of a killer.<br />
I&#8217;m wondering if I could take care of this using PNGencoder or perhaps JPGencoder.</p>
<p>But for now I&#8217;m happy&#8230; The <a href="http://labs.nocreativity.com/rendering/Tien.html" target="_blank">final result</a> (for now) can be seen here.</p>
<p>Thanks everybody for helping me out. You guys rock!</p>
<p>PS: The <a href="http://www.flickr.com/photos/7258342@N05/3044433024/in/pool-digitaldesignandmedia" target="_blank" target="_blank">picture</a> used in this experiment was taken by <a href="http://www.flickr.com/people/7258342@N05/" target="_blank" target="_blank">Thomas Heylen</a>. Thanks Thomas!</p>
]]></content:encoded>
			<wfw:commentRss>http://nocreativity.com/blog/world360-unbugged-and-kicking/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>World360 update, now with PNG bug!</title>
		<link>http://nocreativity.com/blog/world360-update-now-with-png-bug</link>
		<comments>http://nocreativity.com/blog/world360-update-now-with-png-bug#comments</comments>
		<pubDate>Sat, 14 Feb 2009 21:17:01 +0000</pubDate>
		<dc:creator>Ronny</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Labs]]></category>
		<category><![CDATA[PNG]]></category>
		<category><![CDATA[World 360]]></category>

		<guid isPermaLink="false">http://nocreativity.com/blog/?p=383</guid>
		<description><![CDATA[Yesterday I decided to get back to my so called &#8216;World360&#8242; experiment. I wanted to speed up the pre-rendering engine. I managed to do that, with some amazing results: Up to 3 times faster overall. Peaks of 800% speed gain! You can view the previous version here. The latest version can be viewed here. I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I decided to get back to my so called <a href="http://nocreativity.com/blog/bitmapdata-is-201-procent-coolness-world-360">&#8216;World360&#8242; experiment</a>. I wanted to speed up the pre-rendering engine. I managed to do that, with some <a href="http://shots.nocreativity.com/33b0f9240dfa8241b8ac01c08abb2436.jpg" target="_blank">amazing results</a>: Up to 3 times faster overall. Peaks of 800% speed gain!</p>
<p>You can view the previous version <a href="http://labs.nocreativity.com/rendering/Negen.html" target="_blank">here</a>.<br />
The latest version can be viewed <a href="http://labs.nocreativity.com/rendering/Tien.html" target="_blank">here</a>.</p>
<p>I&#8217;m very happy with that, but there&#8217;s one little problem. I started to notice a very ugly black border around redrawn PNG transparency (which happens when the animation is pre-renderd).</p>
<div style="margin-left: auto; margin-right: auto; width: 400px;">
<div id="attachment_384" class="wp-caption alignleft" style="width: 167px"><img class="size-full wp-image-384" title="clean" src="http://nocreativity.com/blog-engine/wp-content/uploads/2009/02/clean.jpg" alt="Result without redrawing bitmap" width="157" height="169" /><p class="wp-caption-text">Result without redrawing bitmap (aka: real time rendering)</p></div>
<div id="attachment_385" class="wp-caption alignleft" style="width: 167px"><img class="size-full wp-image-385" title="dirty" src="http://nocreativity.com/blog-engine/wp-content/uploads/2009/02/dirty.jpg" alt="Result when redrawing the bitmap" width="157" height="169" /><p class="wp-caption-text">Result when redrawing the bitmap (aka pre-rendering)</p></div>
</div>
<p style="clear:both"><span id="more-383"></span>I have no clue what is going on&#8230; I have been looking into this issue all day, to no avail&#8230; If anyone knows what is going on, feel free to enlighten me.</p>
<p style="clear:both">The PNG file is fine, it&#8217;s not corrupt or badly exported, since it works just fine in different versions of the render engine. I do however wonder if redrawing a bitmap over and over again doesn&#8217;t create some kind of noise.</p>
<p style="clear:both">If you feel like giving it a shot you can download the .as file <a href="http://nocreativity.com/blog-engine/wp-content/uploads/2009/02/tien.as" target="_blank">here</a>, or get the complete Flash project (.fla + .as + assets) <a href="http://nocreativity.com/blog-engine/wp-content/uploads/2009/02/tien.zip">here</a>. (The code is quite messy&#8230; Just so you know <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )<br />
If anyone can point me into the right direction, your help would be much appreciated (and you shall be remembered forever)!</p>
<p style="clear:both">To illustrate the difference I uploaded 2 more versions.<br />
Check out the previous version <a href="http://labs.nocreativity.com/rendering/trouble/Negen.html" target="_blank">here</a> (longer render time, but no PNG problem).<br />
See the latest version <a href="http://labs.nocreativity.com/rendering/trouble/Tien.html" target="_blank">here</a> (using the faster implementation, generating very ugly black borders).
</p>
<p style="clear:both">Edit: You can download the sources for V9 and V10 <a href="http://nocreativity.com/blog-engine/wp-content/uploads/2009/02/sources.zip">here</a> to see the difference of the result.</p>
]]></content:encoded>
			<wfw:commentRss>http://nocreativity.com/blog/world360-update-now-with-png-bug/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Webcam motion detection coolness</title>
		<link>http://nocreativity.com/blog/webcam-motion-detection-coolness</link>
		<comments>http://nocreativity.com/blog/webcam-motion-detection-coolness#comments</comments>
		<pubDate>Sun, 18 Jan 2009 17:43:21 +0000</pubDate>
		<dc:creator>Ronny</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Open-source]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[detection]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[motion]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[webcam]]></category>
		<category><![CDATA[webcam motion]]></category>
		<category><![CDATA[webcam motion detection]]></category>

		<guid isPermaLink="false">http://nocreativity.com/blog/?p=355</guid>
		<description><![CDATA[A few weeks ago I had to create an innovative way to scroll in a page. I have seen tons of scrollbars in Flash and I found it hard to create something completely new. At one point I wondered if I could wire the scrollbar to a webcam using Actionscript&#8230; So I started experimenting around&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://nocreativity.com/blog-engine/wp-content/uploads/2009/01/picture-1071.jpg"><img class="aligncenter size-large wp-image-357" title="Webcam motion detection: step by step development" src="http://nocreativity.com/blog-engine/wp-content/uploads/2009/01/picture-1071-1024x533.jpg" alt="Webcam motion detection: step by step development" width="491" height="256" /></a></p>
<p>A few weeks ago I had to create an innovative way to scroll in a page. I have seen tons of scrollbars in Flash and I found it hard to create something completely new. At one point I wondered if I could wire the scrollbar to a webcam using Actionscript&#8230; So I started experimenting around&#8230;</p>
<p>When I first started I quickly ran into a problem: How the hell do I know if anything is moving? So I actually got stuck right in the beginning.<br />
I went on a Google trip which led me to <a href="http://newmovieclip.wordpress.com/" target="_blank" target="_blank">Koen</a>&#8216;s post about <a href="http://newmovieclip.wordpress.com/2006/06/11/detect-and-locate-webcam-motion-in-flash-8/" target="_blank" target="_blank">motion detection</a>. Koen was checking all the pixels (using nested loops) to calculate color values. I figured this generated way too much overhead. There had to be a better/simpeler way.</p>
<p>In his post Koen mentioned an article, written by <a href="http://www.flashguru.co.uk/" target="_blank" target="_blank">Guy Watson</a>, concerning <a href="http://www.adobe.com/devnet/flash/articles/webcam_motion.html" target="_blank" target="_blank">an other way</a> to get motion detection going. To make things simple: Guy just takes 2 pictures &#8211; one of the previous frame, one of the current &#8211; puts them on top of eachother, and applies the difference blend mode to the upper one: Tadaaa! There we go! The &#8216;unchanged&#8217; pixels are blacked out. The remaining pixels are the difference in the picture&#8230; which reflects movement. <span id="more-355"></span></p>
<p>So I went back to Flash and put something similar together. All I had to do now was clean up the image, turn the difference remainings white, and detect what in the picture remains white.</p>
<p>That last part turned out to be quite tricky too. When I first got to that milestone I quickly checked the BitmapData class for intresting methods, but I didn&#8217;t find anything intresting. Later on, I talked to <a href="http://Peterelst.com" target="_blank" target="_blank">Peter Elst</a> and Koen at Flex Camp, and they told me to look again because there actually was a function: getColorBoundsRect()</p>
<p>There we go: that&#8217;s a solution right there! And it worked out just fine!<br />
You can test it for yourself in this <a href="http://labs.nocreativity.com/webcammotiondetection/"rel="shadowbox"  target="_blank">little test application</a> &#8211; requires a webcam (duh!)</p>
<h3>Download</h3>
<p>Flex Project source: <a href="http://labs.nocreativity.com/webcammotiondetection/source.zip">source.zip</a><br />
Webcam motion detector class (Actionscript 3): <a href="http://labs.nocreativity.com/webcammotiondetection/MotionDetector.zip">MotionDetector.zip</a></p>
<p>I was planning on adding a &#8216;sensitivity&#8217; property for motion detection but that turned out to be a bit harder. So I decided to postpone that for now (procrastination is a bitch <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )<br />
Feel free to suggest better ways of doing this. I&#8217;m still pretty sure I&#8217;m creating a bit too much overhead to make this work <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://nocreativity.com/blog/webcam-motion-detection-coolness/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

