<?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>NRG³ Blog &#187; Flash &amp; Actionscript</title>
	<atom:link href="http://www.nrg3.nl/blog/category/flash-actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nrg3.nl/blog</link>
	<description></description>
	<lastBuildDate>Tue, 27 Jul 2010 16:48:03 +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>I am a God</title>
		<link>http://www.nrg3.nl/blog/2010/04/i-am-a-god/</link>
		<comments>http://www.nrg3.nl/blog/2010/04/i-am-a-god/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 12:07:34 +0000</pubDate>
		<dc:creator>Jos</dc:creator>
				<category><![CDATA[Flash & Actionscript]]></category>
		<category><![CDATA[Leesvoer]]></category>

		<guid isPermaLink="false">http://www.nrg3.nl/blog/?p=1407</guid>
		<description><![CDATA[


nice, Ralph!

]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.nrg3.nl%252Fblog%252F2010%252F04%252Fi-am-a-god%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fbit.ly%2FcHoir5%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22I%20am%20a%20God%22%20%7D);"></div>
<p><a href="http://www.nrg3.nl/blog/wp-content/uploads/2010/04/90032524.png" rel="lightbox[1407]"><img class="alignnone size-full wp-image-1408" title="90032524" src="http://www.nrg3.nl/blog/wp-content/uploads/2010/04/90032524.png" alt="" width="442" height="442" /></a></p>
<p>nice, <a href="https://twitter.com/UnitZeroOne" target="_blank">Ralph</a>!</p>

]]></content:encoded>
			<wfw:commentRss>http://www.nrg3.nl/blog/2010/04/i-am-a-god/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>actionscript 3 programmeer tips</title>
		<link>http://www.nrg3.nl/blog/2009/08/actionscript-3-programmeer-tips/</link>
		<comments>http://www.nrg3.nl/blog/2009/08/actionscript-3-programmeer-tips/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 08:44:51 +0000</pubDate>
		<dc:creator>Jos</dc:creator>
				<category><![CDATA[Flash & Actionscript]]></category>

		<guid isPermaLink="false">http://www.nrg3.nl/blog/?p=1124</guid>
		<description><![CDATA[Hier, krijg je een aantal tips van me waarmee je wellicht je actionscript 3 programmeerkunsten ietwat kunt verbeteren. Deze post is niet bedoeld voor geavanceerde actionscript 3 programmeurs, maar voor de beginners en overstappers van actionscript 2.]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.nrg3.nl%252Fblog%252F2009%252F08%252Factionscript-3-programmeer-tips%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22actionscript%203%20programmeer%20tips%22%20%7D);"></div>
<p>Hier, krijg je een aantal tips van me waarmee je wellicht je actionscript 3 programmeerkunsten ietwat kunt verbeteren. Deze post is niet bedoeld voor geavanceerde actionscript 3 programmeurs, maar voor de beginners en overstappers van actionscript 2.</p>
<p><span id="more-1124"></span></p>
<p><strong>1. probeer niet opnieuw het wiel uit te vinden</strong><br />
Je kunt zelf een fantastische 3D engine in actionscript gaan schrijven. Maar waarom zou je? Er is er inmiddels een aantal die al een tijdje meegaan en nagenoeg alle klappen van de zweep hebben gehad. Ander bekend voorbeeld; een tweening engine. Ook daar zijn er inmiddels zoveel van dat het eigenlijk zonde van de tijd is om er zelf een te gaan schrijven voor gebruik in je projecten. Een goed begin is <a href="http://www.riaforge.org" target="_blank">riaforge</a>.</p>
<p><strong>2. verdeel en heers</strong><br />
Probeer je code -desnoods achteraf- in kleine classes en methods te verdelen. Je code blijft zo overzichtelijk en begrijpelijk. Een ander voordeel is dat je vaak een aantal kleine methods heel handig kan hergebruiken binnnen je class. Als je bijv. steeds een aantal clips gaat uitfaden en daarna verwijderen kun je ook een method maken die je een array met clips kan meegeven. Deze method handelt verder alle benodigde acties af voor elk van de clips en zo kun je &#8216;m keer op keer hergebruiken.</p>
<p><strong>3. denk vooruit, hergebruik</strong><br />
Als je één keer een groot formulier hebt gechecked, wil je dat bij een nieuw project niet opnieuw programmeren. Bouw daarom je eigen framework op. Maak bijv. een class die alle mogelijke formulier elementen kan valideren. Of een class die de extentie uit een filenaam kan halen. Of wat dacht je van een DataManager class die een xml file inleest en meld wanneer dit gereed is. Als je dit niet steeds opnieuw hoeft te programmeren kun je je telkens meer bezighouden met innovaties.</p>
<p><strong>4. ruim meteen op</strong><br />
Een enorm belangrijk -en nog steeds onderschat- aspect van programmeren is het opruimen. De player ruimt zelf een hoop op als objecten ineens niet meer bestaan, maar je wilt zelf de controle houden en zeker weten dat er geen listeners of timers blijven draaien. Daarom, telkens als je listeners aan objecten hangt, maak dan meteen een method die ze er weer af haalt. Maak je timers aan, maak een method die ze weer weghaalt. Maak bij grotere projecten bijv. een interface class aan die een cleanup method voorschrijft, zodat je telkens gedwongen word de boel op te ruimen. Dit kan het verschil maken tussen een stabiele of labiele applicatie.</p>
<p><strong>5. gebruik proxies</strong><br />
Proxy classes zijn doorgeefluiken. Een goed voorbeeld is een proxy voor een verbinding met iets buiten je applicatie (bijv. een webservice). Stel je hebt een applicatie gemaakt die via verschillende classes met een database praat. Het script dat dit verzorgt is in php geschreven en je roept steeds een script aan met paramaters. Als je nu ooit deze scripts gaat veranderen naar asp, of je zet de boel op een andere plek, moet je in al je classes je methods aanpassen. Misschien gaat de afhandeling wel ineens heel anders of krijg je ineens objecten terug i.p.v. een simpele string.<br />
Als je een procy class schrijft die alle handelingen overneemt en waar dus de volledige communicatie in zit met al deze scripts, hoef je in je applicatie classes alleen de proxy class aan te spreken. Verandert de backend volledig, dan hoef je alleen je proxy aan te passen (of je schrijft een nieuwe proxy, zodat je kunt wisselen).<br />
Een simpeler voorbeeld is die ik zelf vaak gebruik: een proxy class voor statistieken. Deze class koppel ik in eerste instantie aan Google Analytics, zodat ik de proxy class kan opgeven wat ik wil meten en Google dit opslaat. Als ik nu een ander systeem kies, kan ik dit gewoon in mijn proxy class aanpassen, zonder dat de applicatie daarvoor op de schop hoeft.</p>
<p><strong>6. doe onderzoek</strong><br />
Vaak heb je iets al eens geprogrammeerd en lijkt het voor de hand te liggen om dat weer zo te doen. Heel goed in het kader van hergebruik. Maar, elke situatie is een nieuwe en soms moet het anders aangepakt worden. Maak daarom zoveel mogelijk tests en kijk goed hoe je applicatie reageert m.b.t. geheugengebruik, framerate, stabiliteit, etc. Probeer bij een project met veel video wat beter werkt: video&#8217;s eerst helemaal inladen, of streamen met een juiste buffer instelling. Probeer in een game wat stabieler is, een vliegtuigje elke cycle naar al z&#8217;n enemies laten kijken of ie ze raakt, of een klein aantal denkbeeldige vlakken bijhouden waarin elke enemy z&#8217;n positie opslaat. Programmeer het en kijk wat er gebeurt.</p>
<p><strong>7. gebruik een debugger</strong><br />
Onderschat nooit de kracht van debugging. Er wordt je ineens zoveel duidelijk als je ziet dat het bericht dat je wilt laten zien niet getoond wordt, dus dat je method helemaal niet eens wordt uitgevoerd. Je zult een hoop aha-erlebenissen beleven als je flink &#8220;om je probleem heen&#8221; debugt. Je kunt trace gebruiken, maar ik raad je echt een debugger / logger aan. Vaak kun je daar met kleuren veel duidelijkheid scheppen in je output. Daarnaast zijn deze eigenlijk allemaal voorzien van recursieve object explorers. Je geeft gewoon een object aan de debugger en in je output krijg je netjes alle properties en methods etc. te zien, zo diep als je aangeeft.</p>
<p><strong>8. try &#8230; catch en if !null</strong><br />
Omdat actionscript 3 veel stricter is dan zijn oude vader, actionscript 2 en de player vanaf versie 9 veel professioneler en gestructureerder is dan oudere, bestaan er tegenwoordig runtime errors. &#8220;Vroeger&#8221; liep de applicatie gewoon vast en daarmee meteen je browser. Nu zie je runtime errors in een window met de mogelijkheid alle verdere scripting uit te schakelen. Deze meldingen wil je niet aan je gebruikers laten zien. Je wilt ze afvangen. Dat kan met try &amp; catch of door na te kijken of je objecten wel bestaan.<br />
Stel je hebt een flink aantal objecten die op elk moment verwijderd kunnen worden door bijv. interactie. Als je dan een timer hebt lopen die alle objecten telkens update zul je fouten krijgen op het moment dat er één wegvalt. Je moet in je update loop dus een check inbouwen of het object nog wel bestaan. Dat kan door te kijken of het object niet null is. Je kunt ook een array met de objecten bijhouden en als het object wordt verwijderd deze array updaten.<br />
Als je dit soort situaties niet zelf in de hand hebt, kun je try &amp; catch gebruiken. Je probeert daarmee de actie die je wilt uitvoeren en als dit niet lukt vang je de runtime error af en doe je er mee wat je wilt in je catch. Heel handig als je dit in een debugger met een rode kleur afbeeld, zodat je meteen ziet dat er iets misgaat.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.nrg3.nl/blog/2009/08/actionscript-3-programmeer-tips/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Actionscript3 banner template (no more _root.clickTag!)</title>
		<link>http://www.nrg3.nl/blog/2009/04/actionscript-3-banner-template-no-more-_rootclicktag/</link>
		<comments>http://www.nrg3.nl/blog/2009/04/actionscript-3-banner-template-no-more-_rootclicktag/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 16:08:41 +0000</pubDate>
		<dc:creator>Jos</dc:creator>
				<category><![CDATA[Flash & Actionscript]]></category>

		<guid isPermaLink="false">http://www.nrg3.nl/blog/?p=873</guid>
		<description><![CDATA[

Steeds meer banners worden tegenwoordig ook in actionscript 3 geprogrammeerd. En dat is voor veel bannerkoninkjes het begin van een hoop ellende, want er bestaat geen _root.clickTag meer (en getURL ook niet)!
Geen paniek jongens en meisjes! Hieronder kun je een actionscript 3 template downloaden waarmee je automatisch de clickTag weer gebruikt die als flashvar wordt [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.nrg3.nl%252Fblog%252F2009%252F04%252Factionscript-3-banner-template-no-more-_rootclicktag%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Actionscript3%20banner%20template%20%28no%20more%20_root.clickTag%21%29%22%20%7D);"></div>
<p>Steeds meer banners worden tegenwoordig ook in actionscript 3 geprogrammeerd. En dat is voor veel bannerkoninkjes het begin van een hoop ellende, want er bestaat geen _root.clickTag meer (en getURL ook niet)!</p>
<p>Geen paniek jongens en meisjes! Hieronder kun je een actionscript 3 template downloaden waarmee je automatisch de clickTag weer gebruikt die als flashvar wordt meegegeven.</p>
<p>update: werkt ook op deze manier: <a href="http://www.nrg3.nl/blog/wp-content/uploads/2009/04/bannertmplas3.swf?clickTag=http://www.nrg3.nl/?contact" target="_blank">[ link ]<br />
</a></p>
<p><a href="http://www.nrg3.nl/blog/wp-content/uploads/2009/04/bannertmplas3.zip">[ download as3 banner template ]<br />
</a></p>
<p>Voor de copy-&amp;-pasters onder jullie: Maak een hitBut op de stage en gooi deze code erbij. Recipe for succes.</p>
<blockquote>
<pre>var clickTagUrl:String;

try
{
 var keyStr:String;
 var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
 for (keyStr in paramObj)
 {
 if (keyStr == 'clickTag' || keyStr == 'clickTAG')
      clickTagUrl = String(paramObj[keyStr]);
 }
}
catch (error:Error)
{
 trace( error.toString() );
}
if (clickTagUrl == null)
{
  trace('!! no clickTag found !!');
}

hitBut.addEventListener(MouseEvent.CLICK, jumpToUrl);

function jumpToUrl(e:MouseEvent):void
{
  trace(clickTagUrl);

  try
  {
   navigateToURL(new URLRequest(clickTagUrl), '_self');
  }
  catch (error:Error)
  {
   trace("error: "+error.toString());
  }
}</pre>
</blockquote>

]]></content:encoded>
			<wfw:commentRss>http://www.nrg3.nl/blog/2009/04/actionscript-3-banner-template-no-more-_rootclicktag/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Actionscript 3 singleton pattern template for FDT 3 (Eclipse)</title>
		<link>http://www.nrg3.nl/blog/2009/03/actionscript-3-singleton-pattern-template-for-fdt-3-eclipse/</link>
		<comments>http://www.nrg3.nl/blog/2009/03/actionscript-3-singleton-pattern-template-for-fdt-3-eclipse/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 14:33:17 +0000</pubDate>
		<dc:creator>Jos</dc:creator>
				<category><![CDATA[Flash & Actionscript]]></category>

		<guid isPermaLink="false">http://www.nrg3.nl/blog/?p=795</guid>
		<description><![CDATA[

&#8220;What? The singleton pattern is gone in FDT3 actionscript 3?&#8221; No it&#8217;s not! You just have to alter a bit of code to get it to work. FDT didn&#8217;t include this template in their version 3. I got the pattern from &#8220;Actionscript 3 with Design Patterns&#8220;. Here&#8217;s the template code to have the CTRL-space-singleton action [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.nrg3.nl%252Fblog%252F2009%252F03%252Factionscript-3-singleton-pattern-template-for-fdt-3-eclipse%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Actionscript%203%20singleton%20pattern%20template%20for%20FDT%203%20%28Eclipse%29%22%20%7D);"></div>
<p>&#8220;What? The singleton pattern is gone in FDT3 actionscript 3?&#8221; No it&#8217;s not! You just have to alter a bit of code to get it to work. FDT didn&#8217;t include this template in their version 3. I got the pattern from &#8220;<a href="http://www.amazon.com/Advanced-ActionScript-3-Design-Patterns/dp/0321426568" target="_blank">Actionscript 3 with Design Patterns</a>&#8220;. Here&#8217;s the template code to have the CTRL-space-singleton action back again :)</p>
<p>Open FDT preferences, goto templates, then add a new one for AS3 (see pic below)</p>
<div style="background-color:#EEEEEE;padding:12px;">
<pre>package ${enclosing_package}
{
	/**
	 * @author ${user}
	 */
	public class ${enclosing_type}
	{
		private static var __instance:${enclosing_type};

		public function ${enclosing_type}(enforcer:SingletonEnforcer) {}

		public static function getInstance():${enclosing_type}
		{
			if (${enclosing_type}.__instance == null)
				__instance	= new ${enclosing_type}( new SingletonEnforcer() );

			return __instance;
		}
	}
}
class SingletonEnforcer {}</pre>
</div>
<p><a href="http://www.nrg3.nl/blog/wp-content/uploads/2009/03/6-3-2009-15-27-20.png" rel="lightbox[795]"><img class="alignnone size-thumbnail wp-image-797" title="6-3-2009-15-27-20" src="http://www.nrg3.nl/blog/wp-content/uploads/2009/03/6-3-2009-15-27-20-150x150.png" alt="6-3-2009-15-27-20" width="150" height="150" /></a></p>

]]></content:encoded>
			<wfw:commentRss>http://www.nrg3.nl/blog/2009/03/actionscript-3-singleton-pattern-template-for-fdt-3-eclipse/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sommige sites&#8230;</title>
		<link>http://www.nrg3.nl/blog/2009/02/sommige-sites/</link>
		<comments>http://www.nrg3.nl/blog/2009/02/sommige-sites/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 13:49:00 +0000</pubDate>
		<dc:creator>Hans</dc:creator>
				<category><![CDATA[Eye candy]]></category>
		<category><![CDATA[Flash & Actionscript]]></category>
		<category><![CDATA[Inspiratie]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://www.nrg3.nl/blog/?p=782</guid>
		<description><![CDATA[

Soms kom je van die sites tegen op het wereldwijde web waaraan je ziet dat iemand (of meerdere mensen) er met liefde aan doorgeploeterd heeft.
Nachten werk, liters energy drinks en koffie, misschien een aantal pakjes sigaretten en flessen whisky. Uiteindelijk werkt het allemaal, je hebt alles gecheckt, in elk detail heb je al je concentratie [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.nrg3.nl%252Fblog%252F2009%252F02%252Fsommige-sites%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Sommige%20sites...%22%20%7D);"></div>
<p>Soms kom je van die sites tegen op het wereldwijde web waaraan je ziet dat iemand (of meerdere mensen) er met liefde aan doorgeploeterd heeft.</p>
<p>Nachten werk, liters energy drinks en koffie, misschien een aantal pakjes sigaretten en flessen whisky. Uiteindelijk werkt het allemaal, je hebt alles gecheckt, in elk detail heb je al je concentratie en aandacht gestopt die je op kon brengen.</p>
<p>Dan mag je heel trots zijn als het over <a title="Ecomagination" href="http://ge.ecomagination.com/smartgrid/#/landing_page">deze website</a> ging.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.nrg3.nl/blog/2009/02/sommige-sites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript 3 particle foam emitter</title>
		<link>http://www.nrg3.nl/blog/2009/02/actionscript-3-particle-foam-emitter/</link>
		<comments>http://www.nrg3.nl/blog/2009/02/actionscript-3-particle-foam-emitter/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 21:22:30 +0000</pubDate>
		<dc:creator>Jos</dc:creator>
				<category><![CDATA[Eye candy]]></category>
		<category><![CDATA[Flash & Actionscript]]></category>

		<guid isPermaLink="false">http://www.nrg3.nl/blog/?p=690</guid>
		<description><![CDATA[

Another dream of actionscript. Although this time a daydream ;-)

Here&#8217;s the source

]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.nrg3.nl%252Fblog%252F2009%252F02%252Factionscript-3-particle-foam-emitter%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Actionscript%203%20particle%20foam%20emitter%22%20%7D);"></div>
<p>Another dream of actionscript. Although this time a daydream ;-)</p>
<p><object width="500" height="300" data="http://www.nrg3.nl/blog/wp-content/uploads/2009/02/particle_dust.swf" type="application/x-shockwave-flash"><param name="name" value="lightning" /><param name="bgcolor" value="#000000" /><param name="align" value="middle" /><param name="src" value="http://www.nrg3.nl/blog/wp-content/uploads/2009/02/particle_dust.swf" /><param name="allowfullscreen" value="false" /><param name="quality" value="high" /></object></p>
<p><a href="http://www.nrg3.nl/blog/wp-content/uploads/2009/02/particle_dustfla.zip">Here&#8217;s</a> the source</p>

]]></content:encoded>
			<wfw:commentRss>http://www.nrg3.nl/blog/2009/02/actionscript-3-particle-foam-emitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automated PNG crop tool in AIR</title>
		<link>http://www.nrg3.nl/blog/2009/02/automated-png-crop-tool-in-air/</link>
		<comments>http://www.nrg3.nl/blog/2009/02/automated-png-crop-tool-in-air/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 11:44:45 +0000</pubDate>
		<dc:creator>Jos</dc:creator>
				<category><![CDATA[Flash & Actionscript]]></category>

		<guid isPermaLink="false">http://www.nrg3.nl/blog/?p=673</guid>
		<description><![CDATA[As a flash programmer or designer, you must run into this as wel. You have a big pile of png's with transparency. You want to crop them to have as minimum transparency as possible (while maintaining the 1px transparent border).

Now here's a tool for ya, which I created in Flex. Select the png dir, then an output dir and off you go. It even outputs the crop positions (left, top, right, bottom) for you in a textfile.

This has no error handling yet, I'm just too lazy to build that. All up to you from here ;-)]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.nrg3.nl%252Fblog%252F2009%252F02%252Fautomated-png-crop-tool-in-air%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Automated%20PNG%20crop%20tool%20in%20AIR%22%20%7D);"></div>
<p>As a flash programmer or designer, you must run into this as wel. You have a big pile of png&#8217;s with transparency. You want to crop them to have as minimum transparency as possible (while maintaining the 1px transparent border).</p>
<p>Now here&#8217;s a tool for ya, which I created in AIR with Flex. Select a dir with PNG&#8217;s, then an output dir and off you go. It even outputs the crop positions (left, top, right, bottom) for you in a textfile.</p>
<p>This has no error handling yet, I&#8217;m just too lazy to build that. <a href="http://www.nrg3.nl/blog/wp-content/uploads/2009/02/autopngcroppermxml.txt" target="_blank">Here&#8217;s the full code</a>. All up to you from here ;-) Oh, you need the <a href="http://code.google.com/p/as3corelib/" target="_blank">as3corelib</a> from Adobe for PNG encoding purpose.</p>
<p>update: <a href="http://www.nrg3.nl/blog/wp-content/uploads/2009/02/autopngcropperair.zip">Here&#8217;s</a> the compiled air file for direct install (you&#8217;ll need to have <a href="http://get.adobe.com/air/" target="_blank">AIR</a> installed)</p>
<p><a href="http://www.nrg3.nl/blog/wp-content/uploads/2009/02/9-2-2009-12-32-43.png" rel="lightbox[673]"><img class="alignnone size-full wp-image-678" title="9-2-2009-12-32-43" src="http://www.nrg3.nl/blog/wp-content/uploads/2009/02/9-2-2009-12-32-43.png" alt="9-2-2009-12-32-43" width="315" height="174" /></a></p>

]]></content:encoded>
			<wfw:commentRss>http://www.nrg3.nl/blog/2009/02/automated-png-crop-tool-in-air/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with webcam and isometric perspective</title>
		<link>http://www.nrg3.nl/blog/2009/02/fun-with-webcam-and-isometric-perspective/</link>
		<comments>http://www.nrg3.nl/blog/2009/02/fun-with-webcam-and-isometric-perspective/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 15:35:56 +0000</pubDate>
		<dc:creator>Jos</dc:creator>
				<category><![CDATA[Eye candy]]></category>
		<category><![CDATA[Flash & Actionscript]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://www.nrg3.nl/blog/?p=663</guid>
		<description><![CDATA[

Remember the old days, with that toy full of spikes? Where you could put your hand on, or face, and it would follow your shape? Man, I&#8217;ve put some funny things in there :-)
So, for all you perverts, and the rest for that matter, here&#8217;s the chance to do it all over again. But then [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.nrg3.nl%252Fblog%252F2009%252F02%252Ffun-with-webcam-and-isometric-perspective%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Fun%20with%20webcam%20and%20isometric%20perspective%22%20%7D);"></div>
<p>Remember the old days, with that toy full of spikes? Where you could put your hand on, or face, and it would follow your shape? Man, I&#8217;ve put some funny things in there :-)</p>
<p>So, for all you perverts, and the rest for that matter, here&#8217;s the chance to do it all over again. But then in a digital manner..</p>
<p><a href="http://www.nrg3.nl/lab/IsoCamFun" target="_blank"><img class="alignnone size-full wp-image-664" title="4-2-2009-16-30-44" src="http://www.nrg3.nl/blog/wp-content/uploads/2009/02/4-2-2009-16-30-44.png" alt="4-2-2009-16-30-44" width="450" height="252" /></a></p>
<p>check: <a href="http://www.nrg3.nl/lab/IsoCamFun" target="_blank">www.nrg3.nl/lab/IsoCamFun</a></p>
<p>Alrighty then, <a href="http://www.nrg3.nl/lab/ISOCamFun/ISOGrid.zip">here&#8217;s</a> the source files.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.nrg3.nl/blog/2009/02/fun-with-webcam-and-isometric-perspective/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript in 2020?</title>
		<link>http://www.nrg3.nl/blog/2009/02/actionscript-in-2020/</link>
		<comments>http://www.nrg3.nl/blog/2009/02/actionscript-in-2020/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 10:21:19 +0000</pubDate>
		<dc:creator>Jos</dc:creator>
				<category><![CDATA[Flash & Actionscript]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[future]]></category>

		<guid isPermaLink="false">http://www.nrg3.nl/blog/?p=651</guid>
		<description><![CDATA[

Being human beings, it&#8217;s in our nature to wonder about the things to come in the near future. It&#8217;s one of the reasons we&#8217;re inventing and innovating as we stride along the yellow brick road.
Hence, as an actionscript programmer, I wonder what the future will hold for actionscript. I&#8217;m deliberately pointing the arrow at actionscript [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.nrg3.nl%252Fblog%252F2009%252F02%252Factionscript-in-2020%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Actionscript%20in%202020%3F%22%20%7D);"></div>
<p>Being human beings, it&#8217;s in our nature to wonder about the things to come in the near future. It&#8217;s one of the reasons we&#8217;re inventing and innovating as we stride along the yellow brick road.</p>
<p>Hence, as an actionscript programmer, I wonder what the future will hold for actionscript. I&#8217;m deliberately pointing the arrow at actionscript instead of Flash, for actionscript has undoubtedly outgrown it&#8217;s mothers womb. Among the output formats today are not only swf, but also AIRborne, mobile and native desktop applications on multiple operating systems.</p>
<p>So the question is: where will actionscript be in.. say.. 2020? Will it still exist? And in what form? Will we have actionscript 4? Or even 5? Or is 3 robust and professional enough to withstand a decade of innovation?</p>
<p>I for one cannot go past the thought that it will absolutely still be alive (and kicking, for that matter). I think it even might still be actionscript 3. The flash players will continue to have amazing new features with every new major build, but my guess would be that actionscript 3 is powerfull and fast enough to cope with these options. But.. I might very well be wrong.</p>
<p>Now, since all you actionscript developers out there must have these same wonderings, I hereby invite you to comment on this article and share your thougts. I&#8217;m very curious for your replies!</p>

]]></content:encoded>
			<wfw:commentRss>http://www.nrg3.nl/blog/2009/02/actionscript-in-2020/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>normalize, interpolate, map</title>
		<link>http://www.nrg3.nl/blog/2008/11/normalize-interpolate-map/</link>
		<comments>http://www.nrg3.nl/blog/2008/11/normalize-interpolate-map/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 15:01:22 +0000</pubDate>
		<dc:creator>Jos</dc:creator>
				<category><![CDATA[Flash & Actionscript]]></category>

		<guid isPermaLink="false">http://www.nrg3.nl/blog/?p=313</guid>
		<description><![CDATA[

Zie hier drie briljant kleine functies om het leven van een programmeur wat aangenamer te maken: normalize, interpolate en map. Ideaal voor het maken van scrollbars, sliders of andere ellende waarbij je de properties van twee objecten met verschillend bereik met elkaar laat communiceren.
normalize geeft je een value tussen 0 en 1 terug op basis [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.nrg3.nl%252Fblog%252F2008%252F11%252Fnormalize-interpolate-map%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22normalize%2C%20interpolate%2C%20map%22%20%7D);"></div>
<p>Zie hier drie briljant kleine functies om het leven van een programmeur wat aangenamer te maken: normalize, interpolate en map. Ideaal voor het maken van scrollbars, sliders of andere ellende waarbij je de properties van twee objecten met verschillend bereik met elkaar laat communiceren.</p>
<p>normalize geeft je een value tussen 0 en 1 terug op basis van de meegegeven value en bereik. Interpolate doet precies het tegenovergestelde. Deze geeft je de waarde terug van een genormalizede waarde binnen het meegegeven bereik. Map is de geniale combinatie van deze twee functies.</p>
<blockquote><p><code>public static function normalize(value:Number, minimum:Number, maximum:Number):Number<br />
{<br />
return (value - minimum) / (maximum - minimum);<br />
}</code></p>
<p><code>public static function interpolate(normValue:Number, minimum:Number, maximum:Number):Number<br />
{<br />
return minimum + (maximum - minimum) * normValue;<br />
}</code></p>
<p><code>public static function map(value:Number, min1:Number, max1:Number, min2:Number, max2:Number):Number<br />
{<br />
return interpolate( normalize(value, min1, max1), min2, max2);<br />
}</code></p></blockquote>
<p>Je hebt &#8216;m nog niet? Ok. Stel je hebt een slider gemaakt en links en rechts de waarden 1kg en 500kg gezet. Je slider loopt van xpos = 50 t/m xpos = 250. Je wilt na het sliden van de user weten welke waarde in kg ie heeft gekozen.</p>
<p>Je normalized eerst de xpos door <code>vNorm = normalize(xpos, 50, 250)</code> te doen. Je weet nu waar je zit op de slider tussen 0 en 1. Deze waarde geef je door aan de interpolate: <code>vInt = interpolate(vNorm, 1, 500)</code> en deze geeft je dan het exacte aantal kg terug. En dat kan dan in één keer met <code>val = map(xpos, 50, 250, 1, 500)</code>!</p>

]]></content:encoded>
			<wfw:commentRss>http://www.nrg3.nl/blog/2008/11/normalize-interpolate-map/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
