<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>FlashFocus.nl - Weblogs</title>
		<link>http://www.flashfocus.nl/forum/blog.php</link>
		<description><![CDATA[De Beste Nederlandstalige Flash Resource Site - FlashFocus.nl Download hier je Flash files (fla's) om van te leren en lees hier het laatste Flash- en webdevelopment nieuws!]]></description>
		<language>nl</language>
		<lastBuildDate>Thu, 29 Jul 2010 23:05:40 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://flashfocus.nl/forum/images/misc/rss.jpg</url>
			<title>FlashFocus.nl - Weblogs</title>
			<link>http://www.flashfocus.nl/forum/blog.php</link>
		</image>
		<item>
			<title>Performance tips</title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=41</link>
			<pubDate>Tue, 25 May 2010 21:18:47 GMT</pubDate>
			<description><![CDATA[Het leek me handig om een artikel te plaatsen met wat kleine performance tips. 
Je performance in de gaten houden is een belangrijk onderdeel bij het maken van goede applicaties. 
Bij de gemiddelde fotogallery of portfolio site is dit misschien niet zo'n big deal. Maar wanneer je met particles of games aan de slag gaat en je bepaalde code uitvoert in onEnterFrame handlers en veel door loops loopt, is het zeker de moeite waard om zo efficiënt mogelijk te programmeren. 
Vaak zijn het kleine...]]></description>
			<content:encoded><![CDATA[<div>Het leek me handig om een artikel te plaatsen met wat kleine performance tips.<br />
Je performance in de gaten houden is een belangrijk onderdeel bij het maken van goede applicaties.<br />
Bij de gemiddelde fotogallery of portfolio site is dit misschien niet zo'n big deal. Maar wanneer je met particles of games aan de slag gaat en je bepaalde code uitvoert in onEnterFrame handlers en veel door loops loopt, is het zeker de moeite waard om zo efficiënt mogelijk te programmeren.<br />
Vaak zijn het kleine handigheidjes die je jezelf even aan moet wennen.<br />
<br />
<br />
Als jullie toevoegingen hebben of onjuistheden opmerken. Dan hoor ik het graag.<br />
<br />
<br />
<b>Math.max en Math.min zijn traag</b><br />
<br />
Het gebruik van Math.max en Math.min is erg traag in vergelijking met een if statement.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:212px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #999999; font-style: italic;">//In plaats van</span><span style="color: #6699cc; font-weight: bold;">var</span> v1<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v2<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">20</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v3<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <a target="_blank" href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">max</span><span style="color: #000000;">&#40;</span>v1<span style="color: #000000; font-weight: bold;">,</span>v2<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//prefereer ik (± 8.5x zo snel)</span><span style="color: #6699cc; font-weight: bold;">var</span> v1<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v2<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">20</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v3<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000;">&#40;</span>v1 <span style="color: #000000; font-weight: bold;">&gt;</span>= v2<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">?</span> v1 <span style="color: #000000; font-weight: bold;">:</span> v2<span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
<b>Math.abs is traag.</b><br />
<br />
Het gebruik van Math.abs is erg traag in vergelijking met een if statement.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:180px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #999999; font-style: italic;">//In plaats van</span><span style="color: #6699cc; font-weight: bold;">var</span> v1<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v2<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <a target="_blank" href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">abs</span><span style="color: #000000;">&#40;</span>v1<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//prefereer ik (± 7.5x zo snel)</span><span style="color: #6699cc; font-weight: bold;">var</span> v1<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v2<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000;">&#40;</span>v1 <span style="color: #000000; font-weight: bold;">&lt;</span> 0<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">?</span> <span style="color: #000000; font-weight: bold;">-</span>v1 <span style="color: #000000; font-weight: bold;">:</span> v1<span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
<b>Math.floor is trager dan casten naar int.</b><br />
<br />
Je kunt Math.floor eenvoudig vermijden door te casten naar int.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:164px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> v1<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">10.5</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v2<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//In plaats van</span>v2 = <a target="_blank" href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span>v1<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//prefereer ik (± 3.5x zo snel)</span>v2 = <a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000000;">&#40;</span>v1<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
Er is nog een snellere methode. Deze is wat minder leesbaar, maar 1.5x sneller dan de int(value) methode.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:100px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> v1<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">10.5</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v2<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000000; font-weight: bold;">;</span>v2 = v1<span style="color: #000000; font-weight: bold;">&gt;&gt;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
<br />
<b><i>Bovenstaande methodes  werken alleen bij positieve getallen!<br />
Als het getal ook negatief kan zijn moet je hier een check voor maken.<br />
Dit is iets trager, maar nog steeds veel sneller dan Math.floor.</i></b><br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:52px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre>v2 = <span style="color: #000000;">&#40;</span>v1<span style="color: #000000; font-weight: bold;">&gt;</span>0<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">?</span> v1 <span style="color: #000000; font-weight: bold;">&gt;&gt;</span>0 <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #000000;">&#40;</span>v1<span style="color: #000000; font-weight: bold;">&gt;&gt;</span>0<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
<b>Math.ceil is ook trager dan casten naar int.</b><br />
<br />
Voor Math.ceil geldt eigenlijk hetzelfde als voor Math.floor.<br />
Alleen kun je niet zomaar naar int casten en er 1 bij optellen:<br />
<br />
Math.ceil(1.2) == 2;<br />
int(1.2)+1 == 2;<br />
Math.ceil(1) == 1;<br />
int(1)+1 == 2;<br />
<br />
Daarom gebruiken we een inline if statement.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:164px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> v1<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">10.5</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v2<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//In plaats van</span>v2 = <a target="_blank" href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">ceil</span><span style="color: #000000;">&#40;</span>v1<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//prefereer ik (± 2.5x zo snel)</span>v2 = <span style="color: #000000;">&#40;</span><a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000000;">&#40;</span>v1<span style="color: #000000;">&#41;</span> == v1<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">?</span> v1 <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000000;">&#40;</span>v1<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
En de bitwise methode zoals bij Math.floor geeft hier zelfs nog iets meer winst dan bij Math.floor het geval is. <br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:100px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> v1<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">10.5</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v2<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000000; font-weight: bold;">;</span>v2 = <span style="color: #000000;">&#40;</span>v1 <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> 0 == v1<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">?</span> v1 <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #000000;">&#40;</span>v1 <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> 0<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
<br />
<b><i>Bovenstaande methodes  werken alleen bij positieve getallen!<br />
Als het getal ook negatief kan zijn moet je hier een check voor maken.<br />
Dit is iets trager, maar nog steeds veel sneller dan Math.ceil.</i></b><br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:52px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre>v2 = <span style="color: #000000;">&#40;</span>v1 <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> 0 == v1<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">?</span> v1 <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #000000;">&#40;</span>v1 <span style="color: #000000; font-weight: bold;">&lt;</span> 0<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">?</span> <span style="color: #000000;">&#40;</span>v1 <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> 0<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #000000;">&#40;</span>v1 <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> 0<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
<b>Vermenigvuldigen is sneller dan delen.</b><br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:84px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #000000; font-weight:bold;">20</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span> <span style="color: #999999; font-style: italic;">//is ± 7% langzamer dan </span>20 <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">.</span>5<span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
<b>Bitwise operations zijn super snel!</b><br />
<br />
Het gebruik van bitwise operations kan je project een flinke performanceboost geven.<br />
Deze zijn echt super snel mits ze gebruikt worden in combinatie met integers.<br />
Als je Numbers gebruikt kun je zomaar voor verrassingen komen te staan.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:132px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> v1<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">20</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v2<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000000; font-weight: bold;">;</span>v2 = v1 <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">.</span>5<span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//is ± 1.4x zo snel als</span>v2 = v1 <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
Maar als we integers gebruiken:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:132px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> v1<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = <span style="color: #000000; font-weight:bold;">20</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v2<span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000000; font-weight: bold;">;</span>v2 = v1 <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//is ± 1.6x zo snel als</span>v2 = v1 <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">.</span>5<span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
<br />
Bitwise operations ronden je getallen wel af op hele getallen. Maar dat zie ik vaker als een voordeel dan een nadeel.<br />
Bijvoorbeeld bij het uitlijnen van textfields. Je wilt textfields altijd op hele pixels plaatsen.<br />
Vaak wil je een textfield in het midden van een knop zetten. Ik gebruik daarvoor de volgende code:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:52px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre>_txt<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> = width<span style="color: #000000; font-weight: bold;">-</span>_txt<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
<b>Een aantal bitwise tricks die in je voordeel kunnen werken mits je ze gebruikt met integers:</b><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:212px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #999999; font-style: italic;">//delen door 2</span><span style="color: #004993;">value</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//vermenigvuldigen met 2</span><span style="color: #004993;">value</span> <span style="color: #000000; font-weight: bold;">&lt;&lt;</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//positief/negatief omdraaien (± 1.2x zo snel)</span><span style="color: #000000; font-weight: bold;">~</span><span style="color: #004993;">value</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000; font-weight: bold;">;</span> <span style="color: #999999; font-style: italic;">// is gelijk aan: value * -1; //en is gelijk aan: &nbsp;-value</span><span style="color: #999999; font-style: italic;">//even/oneven controleren</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span> <span style="color: #000000; font-weight: bold;">&amp;</span> 1<span style="color: #000000;">&#41;</span> == <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span> <span style="color: #999999; font-style: italic;">//is gelijk aan: (value % 2) == 0;</span></div></div></pre>
</div><br />
<b>Integers zijn sneller dan Numbers.<br />
</b><br />
Sommige van de hierboven beschreven methode gaan uit van een bepaald datatype.<br />
De behaalde resultaten kunnen namelijk nogal verschillen tussen bepaalde datatypen.<br />
<br />
<i>Voorbeeld:</i><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:132px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> v1<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = <span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">11</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v2<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//dit:</span>v2 = v1<span style="color: #000000; font-weight: bold;">*-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//is sneller dan</span>v2 = <span style="color: #000000; font-weight: bold;">-</span>v1<span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
Maar, als je ditzelfde met Numbers doet:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:132px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> v1<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">11</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v2<span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//is dit ± 15% sneller:</span>v2 = <span style="color: #000000; font-weight: bold;">-</span>v1<span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//dan:</span>v2 = v1<span style="color: #000000; font-weight: bold;">*-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
Over het algemeen zijn integers sneller.<br />
Gebruik daarom ook altijd integers in loops en bij voorkeur uints als de loop optelt.<br />
In flash player 9 was de performance van uints belachelijk slecht. In veel gevallen waren uints zelfs trager dan Numbers.<br />
Hierom kozen veel developers voor ints als loop counter. Ik ben hier eigenlijk nooit in mee gegaan, omdat het meer sense maakt om uints te gebruiken in een positieve loop. Daar zijn ze immers voor.<br />
Gelukkig is de performance van uints in flash player 10 zoals deze moet zijn. (hetzelfde of zelfs iets sneller dan ints)<br />
<br />
<i>loop voorbeeld:</i><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:116px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span> i<span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000; font-weight: bold;">;</span> i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span>ipv<span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span> i<span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000; font-weight: bold;">;</span> i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span>en ipv<span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span> i<span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000; font-weight: bold;">;</span> i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span></div></div></pre>
</div><br />
Als je loop counter negatief kan worden gebruik je natuurlijk ints.<br />
<br />
<b>Gebruik geen array.push als dit niet nodig is.</b><br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:132px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> arr<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a> = <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> a<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span> a <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">10000000</span><span style="color: #000000; font-weight: bold;">;</span> a<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>	arr<span style="color: #000000;">&#91;</span>a<span style="color: #000000;">&#93;</span> = a <span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
is eens zo snel als:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:132px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> arr<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a> = <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> a<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span> a <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">10000000</span><span style="color: #000000; font-weight: bold;">;</span> a<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>	arr<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>a<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
<b>Gebruik Vectors waar je maar kunt.</b><br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:132px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> arr<span style="color: #000000; font-weight: bold;">:</span>Vector<span style="color: #000000; font-weight: bold;">.&lt;</span>uint<span style="color: #000000; font-weight: bold;">&gt;</span> = <span style="color: #0033ff; font-weight: bold;">new</span> Vector<span style="color: #000000; font-weight: bold;">.&lt;</span>uint<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> a<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span> a <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">10000000</span><span style="color: #000000; font-weight: bold;">;</span> a<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>	arr<span style="color: #000000;">&#91;</span>a<span style="color: #000000;">&#93;</span> = a <span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
is eens zo snel als:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:132px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> arr<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a> = <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> a<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span> a <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">10000000</span><span style="color: #000000; font-weight: bold;">;</span> a<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>	arr<span style="color: #000000;">&#91;</span>a<span style="color: #000000;">&#93;</span> = a<span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
<b>Sla de length van je array/vector op in een variable voor je gaat loopen.</b><br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:116px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> l<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = arr<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span> i <span style="color: #000000; font-weight: bold;">&lt;</span> l<span style="color: #000000; font-weight: bold;">;</span> i<span style="color: #000000; font-weight: bold;">++</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>	v2 = arr<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
is 5x! sneller dan:<br />
<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:100px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span> i <span style="color: #000000; font-weight: bold;">&lt;</span> arr<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000000; font-weight: bold;">;</span> i<span style="color: #000000; font-weight: bold;">++</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>	v2 = arr<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
<b>De 'one dot' regel.</b><br />
<br />
Als je meerdere keren een property aan wilt spreken waar je meer dan één . voor nodig hebt, sla hem dan op in een lokale variable.<br />
<br />
<i>Voorbeeld:</i><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:228px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> mc<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a target="_blank" href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>mc<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">data</span> = <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><span style="color: #000000; font-weight: bold;">;</span>mc<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">data</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">value</span><span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> prop<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = mc<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">data</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> a<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span> a <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">10000000</span><span style="color: #000000; font-weight: bold;">;</span> a<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span><span style="color: #004993;">value</span> = prop<span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
is 10x! zo snel als:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:196px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> mc<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a target="_blank" href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>mc<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">data</span> = <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><span style="color: #000000; font-weight: bold;">;</span>mc<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">data</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">value</span><span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000000; font-weight: bold;">;</span><span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> a<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span> a <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">10000000</span><span style="color: #000000; font-weight: bold;">;</span> a<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span><span style="color: #004993;">value</span> = mc<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">data</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
<b>Gebruik de ternary operator.</b><br />
<br />
De ternary operator is niet zozeer sneller dan een 'normaal' if statement, maar het maakt je code wel een stuk compacter en leesbaarder. Let wel op dat je het condition gedeelte altijd tussen ( ) zet. Doe je dit niet werkt je code prima, geen error aan de lucht. Maar het is 10% langzamer dan wanneer het condintion gedeelte tussen ( ) staat.<br />
<br />
Dus:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:84px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre>result = <span style="color: #000000;">&#40;</span>value1==value2<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">?</span> <span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//ipv</span>result = value1==value2 <span style="color: #000000; font-weight: bold;">?</span> <span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:148px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> v1<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> v2<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//dit:</span>v2 = <span style="color: #000000;">&#40;</span>v1 <span style="color: #000000; font-weight: bold;">&lt;</span> 0<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">?</span> <span style="color: #000000; font-weight: bold;">-</span>v1 <span style="color: #000000; font-weight: bold;">:</span> v1<span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">// is iets langzamer dan:</span><span style="color: #000000;">&#40;</span>v1 <span style="color: #000000; font-weight: bold;">&lt;</span> 0<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">?</span> v2 = <span style="color: #000000; font-weight: bold;">-</span>v1 <span style="color: #000000; font-weight: bold;">:</span> v2 = v1<span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><br />
In het bovenstaande voorbeeld gebruik ik persoonlijk altijd de langzamere methode.<br />
We praten hier over een paar milliseconden op 10000000 checks. En ik vind de eerste methode een stuk leesbaarder. <br />
<br />
<b>Nog een lijstje met tips:</b><br />
<br />
* Gebruik een zo strikt mogelijk datatype.<br />
* Enterframes zijn sneller dan timers.<br />
* Gebruik zo min mogelijk enterframe handlers en/of timer handlers.<br />
* Constanten zijn sneller dan variablen.<br />
* Zet geen 'zware' code in je constructors. Maak liever een init functie die je aanroept in je constructor.<br />
* Callbacks meegeven is sneller dan events dispatchen.<br />
* Test zelf hoe bepaalde optimalisaties uitpakken in jouw project.<br />
* Draaf niet te ver door met optimaliseren. Een paar milliseconden winst in ruil voor een moeilijk leesbare code zou ik niet aan willen raden.<br />
<br />
<br />
<i>Stellingen in bovenstaand document zijn gebaseerd op testresultaten behaald met de flash 10.1 IDE player van CS5 op Windows Vista 64bit.<br />
Vooral in flash player 9 kunnen de resultaten nog wel eens anders uitpakken. Test daarom altijd zelf en neem niet zomaar aan wat je op internet leest.</i></div>

]]></content:encoded>
			<dc:creator>marcvz</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=41</guid>
		</item>
		<item>
			<title>FF-Experiment voorbeeld :  SFX</title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=40</link>
			<pubDate>Tue, 13 Apr 2010 12:56:24 GMT</pubDate>
			<description><![CDATA[Image: http://www.neuroproductions.be/ff/sfxpush.png  
 
Voor het eerste FlashFocus experiment (http://www.flashfocus.nl/forum/showthread.php?p=395084) een voorbeeld met particles en bitmapdata. 
 
http://www.neuroproductions.be/ff/FFparticles.swf 
 
 
Ik ga er wel vanuit dat je al een redelijke basis kennis hebt als je hieraan begint. Ik geef enkel een korte uitleg voor de iets 'moeilijkere' stukken. Maar als je specifieke vragen over dit voorbeeld hebt, mag je die natuurlijk altijd hier...]]></description>
			<content:encoded><![CDATA[<div><img src="http://www.neuroproductions.be/ff/sfxpush.png" border="0" alt="" /><br />
<br />
Voor het eerste <a href="http://www.flashfocus.nl/forum/showthread.php?p=395084" target="_blank">FlashFocus experiment</a> een voorbeeld met particles en bitmapdata.<br />
<br />
<a href="http://www.neuroproductions.be/ff/FFparticles.swf" target="_blank">http://www.neuroproductions.be/ff/FFparticles.swf</a><br />
<br />
<br />
Ik ga er wel vanuit dat je al een redelijke basis kennis hebt als je hieraan begint. Ik geef enkel een korte uitleg voor de iets 'moeilijkere' stukken. Maar als je specifieke vragen over dit voorbeeld hebt, mag je die natuurlijk altijd hier stellen. :)<br />
<br />
<br />
De sourcecode kan je <a href="http://www.flashfocus.nl/forum/attachment.php?attachmentid=9557&amp;d=1270726490" target="_blank">hier</a> downloaden.<br />
<br />
<font size="3">De 2 classe</font><br />
<br />
Main class  ( FFparticles.as)<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:516px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #9900cc; font-weight: bold;">package</span><span style="color: #000000;">&#123;</span>	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000000; font-weight: bold;">.</span><a target="_blank" href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000; font-weight: bold;">;</span>	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000000; font-weight: bold;">.</span><a target="_blank" href="http://www.google.com/search?q=bitmap%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmap.html"><span style="color: #004993;">Bitmap</span></a><span style="color: #000000; font-weight: bold;">;</span>	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000000; font-weight: bold;">.</span><a target="_blank" href="http://www.google.com/search?q=bitmapdata%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmapdata.html"><span style="color: #004993;">BitmapData</span></a><span style="color: #000000; font-weight: bold;">;</span>	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000000; font-weight: bold;">.</span><a target="_blank" href="http://www.google.com/search?q=bitmapdatachannel%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmapdatachannel.html"><span style="color: #004993;">BitmapDataChannel</span></a><span style="color: #000000; font-weight: bold;">;</span>	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000000; font-weight: bold;">.</span><a target="_blank" href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000000; font-weight: bold;">;</span>	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000000; font-weight: bold;">.</span><a target="_blank" href="http://www.google.com/search?q=stagealign%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:stagealign.html"><span style="color: #004993;">StageAlign</span></a><span style="color: #000000; font-weight: bold;">;</span>	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000000; font-weight: bold;">.</span><a target="_blank" href="http://www.google.com/search?q=stagescalemode%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:stagescalemode.html"><span style="color: #004993;">StageScaleMode</span></a><span style="color: #000000; font-weight: bold;">;</span>	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000000; font-weight: bold;">.</span><a target="_blank" href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000; font-weight: bold;">;</span>	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.filters</span><span style="color: #000000; font-weight: bold;">.</span><a target="_blank" href="http://www.google.com/search?q=blurfilter%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:blurfilter.html"><span style="color: #004993;">BlurFilter</span></a><span style="color: #000000; font-weight: bold;">;</span>	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span><span style="color: #000000; font-weight: bold;">.</span><a target="_blank" href="http://www.google.com/search?q=colortransform%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:colortransform.html"><span style="color: #004993;">ColorTransform</span></a><span style="color: #000000; font-weight: bold;">;</span>			<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> FFparticles <span style="color: #0033ff; font-weight: bold;">extends</span> <a target="_blank" href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a>	<span style="color: #000000;">&#123;</span>		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> bmd <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=bitmapdata%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmapdata.html"><span style="color: #004993;">BitmapData</span></a><span style="color: #000000; font-weight: bold;">;</span>		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> bmdPerlin <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=bitmapdata%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmapdata.html"><span style="color: #004993;">BitmapData</span></a><span style="color: #000000; font-weight: bold;">;</span>		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> sizeH <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = <span style="color: #000000; font-weight:bold;">400</span><span style="color: #000000; font-weight: bold;">;</span>		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> sizeW <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = <span style="color: #000000; font-weight:bold;">600</span><span style="color: #000000; font-weight: bold;">;</span>		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> particles <span style="color: #000000; font-weight: bold;">:</span> Vector<span style="color: #000000; font-weight: bold;">.&lt;</span>Particle<span style="color: #000000; font-weight: bold;">&gt;</span> = <span style="color: #0033ff; font-weight: bold;">new</span> Vector<span style="color: #000000; font-weight: bold;">.&lt;</span>Particle<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>						<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">colorTransform</span> <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=colortransform%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:colortransform.html"><span style="color: #004993;">ColorTransform</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a target="_blank" href="http://www.google.com/search?q=colortransform%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:colortransform.html"><span style="color: #004993;">ColorTransform</span></a><span style="color: #000000;">&#40;</span>0<span style="color: #000000; font-weight: bold;">.</span>999<span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000; font-weight: bold;">.</span>95<span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000; font-weight: bold;">.</span>6<span style="color: #000000; font-weight: bold;">,</span> 1<span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">filter</span> <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=blurfilter%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:blurfilter.html"><span style="color: #004993;">BlurFilter</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a target="_blank" href="http://www.google.com/search?q=blurfilter%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:blurfilter.html"><span style="color: #004993;">BlurFilter</span></a><span style="color: #000000;">&#40;</span>2<span style="color: #000000; font-weight: bold;">,</span>2<span style="color: #000000; font-weight: bold;">,</span> 1<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>								<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> FFparticles<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>		<span style="color: #000000;">&#123;</span>			<span style="color: #004993;">stage</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">scaleMode</span> = <a target="_blank" href="http://www.google.com/search?q=stagescalemode%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:stagescalemode.html"><span style="color: #004993;">StageScaleMode</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">NO_SCALE</span><span style="color: #000000; font-weight: bold;">;</span>			<span style="color: #004993;">stage</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">align</span> = <a target="_blank" href="http://www.google.com/search?q=stagealign%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:stagealign.html"><span style="color: #004993;">StageAlign</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">TOP_LEFT</span><span style="color: #000000; font-weight: bold;">;</span>						bmd = <span style="color: #0033ff; font-weight: bold;">new</span> <a target="_blank" href="http://www.google.com/search?q=bitmapdata%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmapdata.html"><span style="color: #004993;">BitmapData</span></a><span style="color: #000000;">&#40;</span>sizeW<span style="color: #000000; font-weight: bold;">,</span> sizeH<span style="color: #000000; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>			<span style="color: #6699cc; font-weight: bold;">var</span> bm <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=bitmap%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmap.html"><span style="color: #004993;">Bitmap</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a target="_blank" href="http://www.google.com/search?q=bitmap%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmap.html"><span style="color: #004993;">Bitmap</span></a><span style="color: #000000;">&#40;</span>bmd<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>						<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>bm<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>						bmdPerlin = <span style="color: #0033ff; font-weight: bold;">new</span> <a target="_blank" href="http://www.google.com/search?q=bitmapdata%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmapdata.html"><span style="color: #004993;">BitmapData</span></a><span style="color: #000000;">&#40;</span>sizeW<span style="color: #000000; font-weight: bold;">,</span> sizeH<span style="color: #000000; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>						<span style="color: #6699cc; font-weight: bold;">var</span> bmPerlin <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=bitmap%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmap.html"><span style="color: #004993;">Bitmap</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a target="_blank" href="http://www.google.com/search?q=bitmap%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmap.html"><span style="color: #004993;">Bitmap</span></a><span style="color: #000000;">&#40;</span>bmdPerlin<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>			bmdPerlin<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">perlinNoise</span><span style="color: #000000;">&#40;</span>200<span style="color: #000000; font-weight: bold;">,</span> 200<span style="color: #000000; font-weight: bold;">,</span> 5<span style="color: #000000; font-weight: bold;">,</span> <a target="_blank" href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">MAX_VALUE</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000; font-weight: bold;">,</span> <a target="_blank" href="http://www.google.com/search?q=bitmapdatachannel%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmapdatachannel.html"><span style="color: #004993;">BitmapDataChannel</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">RED</span> <span style="color: #000000; font-weight: bold;">|</span> <a target="_blank" href="http://www.google.com/search?q=bitmapdatachannel%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmapdatachannel.html"><span style="color: #004993;">BitmapDataChannel</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">GREEN</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>			bmPerlin<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> = sizeW<span style="color: #000000; font-weight: bold;">;</span>			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>bmPerlin<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>									buildParticles<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a target="_blank" href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #004993;">loop</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>			<span style="color: #004993;">stage</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a target="_blank" href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000000; font-weight: bold;">,</span> refreshNoise<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>		<span style="color: #000000;">&#125;</span>				<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> refreshNoise<span style="color: #000000;">&#40;</span>event <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>		<span style="color: #000000;">&#123;</span>			bmdPerlin<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">perlinNoise</span><span style="color: #000000;">&#40;</span>200<span style="color: #000000; font-weight: bold;">,</span> 200<span style="color: #000000; font-weight: bold;">,</span> 5<span style="color: #000000; font-weight: bold;">,</span> <a target="_blank" href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">MAX_VALUE</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000; font-weight: bold;">,</span> <a target="_blank" href="http://www.google.com/search?q=bitmapdatachannel%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmapdatachannel.html"><span style="color: #004993;">BitmapDataChannel</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">RED</span> <span style="color: #000000; font-weight: bold;">|</span> <a target="_blank" href="http://www.google.com/search?q=bitmapdatachannel%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmapdatachannel.html"><span style="color: #004993;">BitmapDataChannel</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">GREEN</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>		<span style="color: #000000;">&#125;</span>				<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">loop</span><span style="color: #000000;">&#40;</span>event <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>		<span style="color: #000000;">&#123;</span>									bmd<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">lock</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>			bmd<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">colorTransform</span><span style="color: #000000;">&#40;</span>bmd<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">rect</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #004993;">colorTransform</span><span style="color: #000000;">&#41;</span>						<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #0033ff; font-weight: bold;">each</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> part <span style="color: #000000; font-weight: bold;">:</span> Particle <span style="color: #0033ff; font-weight: bold;">in</span> particles<span style="color: #000000;">&#41;</span>			<span style="color: #000000;">&#123;</span>								<span style="color: #6699cc; font-weight: bold;">var</span> kleur <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = bmdPerlin<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">getPixel</span><span style="color: #000000;">&#40;</span>part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">,</span> part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>				<span style="color: #6699cc; font-weight: bold;">var</span> rood <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = kleur <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> 16 <span style="color: #000000; font-weight: bold;">&amp;</span> 0xFF<span style="color: #000000; font-weight: bold;">;</span>				<span style="color: #6699cc; font-weight: bold;">var</span> groen <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = kleur <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> 8 <span style="color: #000000; font-weight: bold;">&amp;</span> 0xFF<span style="color: #000000; font-weight: bold;">;</span>				part<span style="color: #000000; font-weight: bold;">.</span>speedx <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #000000;">&#40;</span>rood <span style="color: #000000; font-weight: bold;">-</span> 128<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">0.002</span><span style="color: #000000; font-weight: bold;">;</span>				part<span style="color: #000000; font-weight: bold;">.</span>speedy <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #000000;">&#40;</span>groen <span style="color: #000000; font-weight: bold;">-</span> 128<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">0.002</span><span style="color: #000000; font-weight: bold;">;</span>																				part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">+</span>= part<span style="color: #000000; font-weight: bold;">.</span>speedx<span style="color: #000000; font-weight: bold;">;</span>				part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">+</span>= part<span style="color: #000000; font-weight: bold;">.</span>speedy <span style="color: #000000; font-weight: bold;">;</span>								part<span style="color: #000000; font-weight: bold;">.</span>speedx <span style="color: #000000; font-weight: bold;">*</span>= <span style="color: #000000; font-weight:bold;">0.985</span><span style="color: #000000; font-weight: bold;">;</span>				part<span style="color: #000000; font-weight: bold;">.</span>speedy <span style="color: #000000; font-weight: bold;">*</span>= <span style="color: #000000; font-weight:bold;">0.985</span><span style="color: #000000; font-weight: bold;">;</span>												<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">&gt;</span> sizeW<span style="color: #000000;">&#41;</span>				<span style="color: #000000;">&#123;</span>					part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">-</span>= sizeW<span style="color: #000000; font-weight: bold;">;</span>				<span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">&lt;</span> 0<span style="color: #000000;">&#41;</span>				<span style="color: #000000;">&#123;</span>					part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">+</span>= sizeW<span style="color: #000000; font-weight: bold;">;</span>				<span style="color: #000000;">&#125;</span>				<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">&gt;</span> sizeH<span style="color: #000000;">&#41;</span>				<span style="color: #000000;">&#123;</span>					part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">-</span>= sizeH<span style="color: #000000; font-weight: bold;">;</span>				<span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">&lt;</span> 0<span style="color: #000000;">&#41;</span>				<span style="color: #000000;">&#123;</span>					part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">+</span>= sizeH<span style="color: #000000; font-weight: bold;">;</span>				<span style="color: #000000;">&#125;</span>												bmd<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">setPixel</span><span style="color: #000000;">&#40;</span>part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">,</span> part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">,</span> 0xFFFFFF<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>			<span style="color: #000000;">&#125;</span>			bmd<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">applyFilter</span><span style="color: #000000;">&#40;</span>bmd<span style="color: #000000; font-weight: bold;">,</span> bmd<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">rect</span><span style="color: #000000; font-weight: bold;">,</span> bmd<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">rect</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">topLeft</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #004993;">filter</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>			bmd<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">unlock</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>					<span style="color: #000000;">&#125;</span>				<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> buildParticles<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; 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;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span>i <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">20000</span><span style="color: #000000; font-weight: bold;">;++</span>i<span style="color: #000000;">&#41;</span>			<span style="color: #000000;">&#123;</span>				<span style="color: #6699cc; font-weight: bold;">var</span> part <span style="color: #000000; font-weight: bold;">:</span> Particle = <span style="color: #0033ff; font-weight: bold;">new</span> Particle<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>				part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <a target="_blank" href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> sizeW<span style="color: #000000; font-weight: bold;">;</span>				part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <a target="_blank" href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> sizeH<span style="color: #000000; font-weight: bold;">;</span>								particles<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>part<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>			<span style="color: #000000;">&#125;</span>						particles<span style="color: #000000; font-weight: bold;">.</span>fixed = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000; font-weight: bold;">;</span>		<span style="color: #000000;">&#125;</span>	<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#125;</span></div></div></pre>
</div>particle class  ( Particle.as)<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:244px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #9900cc; font-weight: bold;">package</span><span style="color: #000000;">&#123;</span>			<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Particle	<span style="color: #000000;">&#123;</span>		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000000; font-weight: bold;">;</span>		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000000; font-weight: bold;">;</span>				<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> speedx<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> =<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span>		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> speedy<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> =<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000; font-weight: bold;">;</span>	<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#125;</span></div></div></pre>
</div><font size="3">Een korte uitleg</font><br />
<br />
Als je heel veel particles wil gebruiken, kan je best geen individuele display objecten gebruiken, maar render je ze beter in een bitmap. <br />
Hier doe ik dat door elke frame  de pixels op de positie van de particles wit te kleuren.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:100px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #0033ff; font-weight: bold;">each</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> part <span style="color: #000000; font-weight: bold;">:</span> Particle <span style="color: #0033ff; font-weight: bold;">in</span> particles<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>	bmd<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">setPixel</span><span style="color: #000000;">&#40;</span>part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">,</span> part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">,</span> 0xFFFFFF<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span></div></div></pre>
</div>Om de richting te bepalen hoe de particles vliegen gebruiken ik perlin noise<br />
Ik maak eerst een perlinnoise bitmap met enkel een rood en een groen waarde.<br />
we geven de perlin noise ook een random seed, zodat de particles elke keer als we refreshen anders vliegen<br />
<br />
Doormiddel van getPixel kijk ik welke kleurwaarde perlinnoise bitmap heeft op de posite van de particle.<br />
<br />
Die kleur splitsen ik op in rood en groen waarde. De rood waarde bepaald de beweging in de x richting en het groen waarde de beweging in de y richting<br />
<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:148px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre>bmdPerlin<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">perlinNoise</span><span style="color: #000000;">&#40;</span>200<span style="color: #000000; font-weight: bold;">,</span> 200<span style="color: #000000; font-weight: bold;">,</span> 5<span style="color: #000000; font-weight: bold;">,</span> <a target="_blank" href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">MAX_VALUE</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000; font-weight: bold;">,</span> <a target="_blank" href="http://www.google.com/search?q=bitmapdatachannel%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmapdatachannel.html"><span style="color: #004993;">BitmapDataChannel</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">RED</span> <span style="color: #000000; font-weight: bold;">|</span> <a target="_blank" href="http://www.google.com/search?q=bitmapdatachannel%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:bitmapdatachannel.html"><span style="color: #004993;">BitmapDataChannel</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">GREEN</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> kleur <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = bmdPerlin<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">getPixel</span><span style="color: #000000;">&#40;</span>part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">,</span> part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> rood <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = kleur <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> 16 <span style="color: #000000; font-weight: bold;">&amp;</span> 0xFF<span style="color: #000000; font-weight: bold;">;</span><span style="color: #6699cc; font-weight: bold;">var</span> groen <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = kleur <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> 8 <span style="color: #000000; font-weight: bold;">&amp;</span> 0xFF<span style="color: #000000; font-weight: bold;">;</span>part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #000000;">&#40;</span>rood <span style="color: #000000; font-weight: bold;">-</span> 128<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000; font-weight: bold;">;</span>part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #000000;">&#40;</span>groen <span style="color: #000000; font-weight: bold;">-</span> 128<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>10 <span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div>Dit werkt, maar op deze manier komen de particles al snel tot stilstand in hun ideale positie.<br />
Dit kunnen we opllosen door ipv de rood en groen waarde te gebruiken voor de verplaatsing, deze te gebruiken voor de versnelling. We tellen ze dus op bij de snelheid. Om de snelheid te dempen voeg ik nog een soort van wrijving toe (de *0.985 ). Die waarde 0.002 en 0.985 zijn proefondervindelijk gekozen. wijzigingen hierin geven een ander resultaat.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:164px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre>part<span style="color: #000000; font-weight: bold;">.</span>speedx <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #000000;">&#40;</span>rood <span style="color: #000000; font-weight: bold;">-</span> 128<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">0.002</span><span style="color: #000000; font-weight: bold;">;</span>part<span style="color: #000000; font-weight: bold;">.</span>speedy <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #000000;">&#40;</span>groen <span style="color: #000000; font-weight: bold;">-</span> 128<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">0.002</span><span style="color: #000000; font-weight: bold;">;</span>part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">+</span>= part<span style="color: #000000; font-weight: bold;">.</span>speedx<span style="color: #000000; font-weight: bold;">;</span>part<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">+</span>= part<span style="color: #000000; font-weight: bold;">.</span>speedy <span style="color: #000000; font-weight: bold;">;</span>part<span style="color: #000000; font-weight: bold;">.</span>speedx <span style="color: #000000; font-weight: bold;">*</span>= <span style="color: #000000; font-weight:bold;">0.985</span><span style="color: #000000; font-weight: bold;">;</span>part<span style="color: #000000; font-weight: bold;">.</span>speedy <span style="color: #000000; font-weight: bold;">*</span>= <span style="color: #000000; font-weight:bold;">0.985</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div>Om de oude particles te laten weg te faden + om een trail effect te krijgen, bluren we de nog eens bitmap elke frame.<br />
<br />
De keur van de trails wijzig ik door elke frame de volledige bitmap te laten colortransformen.<br />
<br />
De colortransform werkt door de rood groen en blauw kleur waarde van elke pixel te vermenigvuldigen <br />
we beginnen met wit 0xFFFFFF= rood 0xFF + groen0xFF  + blauw 0xFF . Door de blauw waarde te vermenigvuldigen met een kleiner getal dan de rood en de groen waarde, daalt deze erg snel, en krijg je iets als 0xFFFF00 =geel, Het zelfde effect heb je met het verschil tussen de rood en groen multiplier , zodat je daarna ongeveer 0xFF0000 = rood krijgt. Op die manier fade de witte pixels van wit naar geel naar rood naar zwart. Door de multipliers te wijzigen kan je andere kleuren bekomen. <br />
<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:132px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">colorTransform</span> <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=colortransform%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:colortransform.html"><span style="color: #004993;">ColorTransform</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a target="_blank" href="http://www.google.com/search?q=colortransform%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:colortransform.html"><span style="color: #004993;">ColorTransform</span></a><span style="color: #000000;">&#40;</span>0<span style="color: #000000; font-weight: bold;">.</span>999<span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000; font-weight: bold;">.</span>95<span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000; font-weight: bold;">.</span>6<span style="color: #000000; font-weight: bold;">,</span> 1<span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000; font-weight: bold;">,</span> 0<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">filter</span> <span style="color: #000000; font-weight: bold;">:</span> <a target="_blank" href="http://www.google.com/search?q=blurfilter%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:blurfilter.html"><span style="color: #004993;">BlurFilter</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a target="_blank" href="http://www.google.com/search?q=blurfilter%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:blurfilter.html"><span style="color: #004993;">BlurFilter</span></a><span style="color: #000000;">&#40;</span>2<span style="color: #000000; font-weight: bold;">,</span>2<span style="color: #000000; font-weight: bold;">,</span> 1<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>bmd<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">colorTransform</span><span style="color: #000000;">&#40;</span>bmd<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">rect</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #004993;">colorTransform</span><span style="color: #000000;">&#41;</span>bmd<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">applyFilter</span><span style="color: #000000;">&#40;</span>bmd<span style="color: #000000; font-weight: bold;">,</span> bmd<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">rect</span><span style="color: #000000; font-weight: bold;">,</span> bmd<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">rect</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">topLeft</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #004993;">filter</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div>Je kan hier een hoop variaties op maken door het perlin noise te manipuleren (of zelfs een andere bitmap te gebruiken)  Of door de berekening van de snelheid wat te wijzigen en met zijn parameters te spelen. <br />
<br />
Veel plezier met dit experiment! Heb je leuke ideeën opgedaan en/of er je eigen experiment van gemaakt? <br />
<a href="http://www.flashfocus.nl/forum/showthread.php?p=395084" target="_blank">Post jouw inzending hier</a>!</div>

]]></content:encoded>
			<dc:creator>Neuro</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=40</guid>
		</item>
		<item>
			<title>FlashDevelop Event Templates</title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=39</link>
			<pubDate>Tue, 06 Apr 2010 07:24:02 GMT</pubDate>
			<description><![CDATA[Dit is geen superuitgebreidde blog, maar meer een handigheid voor FlashDevelop-gebruikers. Ik heb een aantal templates gemaakt die je kunt gebruiken om makkelijk events met parameters (met een mini-wizard) aan te maken:  
 
Image: http://projects.stroep.nl/flashdevelop/event-templates.png  (http://projects.stroep.nl/flashdevelop/) 
http://projects.stroep.nl/flashdevelop/ 
 
*Hoe te installeren* 
 
Ga naar FlashDevelop > Tools > Application files 
  - Ga naar templates/AS3Project 
  - Maak een...]]></description>
			<content:encoded><![CDATA[<div>Dit is geen superuitgebreidde blog, maar meer een handigheid voor FlashDevelop-gebruikers. Ik heb een aantal templates gemaakt die je kunt gebruiken om makkelijk events met parameters (met een mini-wizard) aan te maken: <br />
<br />
<a href="http://projects.stroep.nl/flashdevelop/" target="_blank"><img src="http://projects.stroep.nl/flashdevelop/event-templates.png" border="0" alt="" /></a><br />
<a href="http://projects.stroep.nl/flashdevelop/" target="_blank">http://projects.stroep.nl/flashdevelop/</a><br />
<br />
<b>Hoe te installeren</b><br />
<br />
Ga naar <i>FlashDevelop &gt; Tools &gt; Application files</i><br />
  - Ga naar <i>templates/AS3Project</i><br />
  - Maak een folder, noem deze '<i>Events</i>' <br />
  - Plaats de bestanden uit de zip in die folder<br />
  - Herstart FlashDevelop</div>

]]></content:encoded>
			<dc:creator>mknol</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=39</guid>
		</item>
		<item>
			<title>Sorteren op datum, UTC string</title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=37</link>
			<pubDate>Tue, 23 Feb 2010 16:51:31 GMT</pubDate>
			<description><![CDATA[Ik ben bezig een eenvoudige class te maken om tweets in een swf te tonen. 
De bestaande API's vind ik wat overkill voor hetgeen ik zoek. Ik wil gewoon een xml met de laatste 20 tweets van een bepaalde user en verder niets. 
 
Die xml kun je gewoon ophalen bij Twitter: 
http://twitter.com/statuses/user_timeline/marcvanzon.xml 
 
Omdat ik de mogelijkheid wil hebben om tweets van verschillende users in 1 array te hebben staan, moet ik sorteren op het created_at veld. 
 
Twitter geeft hier een...]]></description>
			<content:encoded><![CDATA[<div>Ik ben bezig een eenvoudige class te maken om tweets in een swf te tonen.<br />
De bestaande API's vind ik wat overkill voor hetgeen ik zoek. Ik wil gewoon een xml met de laatste 20 tweets van een bepaalde user en verder niets.<br />
<br />
Die xml kun je gewoon ophalen bij Twitter:<br />
<a href="http://twitter.com/statuses/user_timeline/marcvanzon.xml" target="_blank">http://twitter.com/statuses/user_tim...marcvanzon.xml</a><br />
<br />
Omdat ik de mogelijkheid wil hebben om tweets van verschillende users in 1 array te hebben staan, moet ik sorteren op het created_at veld.<br />
<br />
Twitter geeft hier een zogenaamde UTC string met de datum en tijd mee.<br />
Leuk en aardig, maar hoe ga je dat sorteren?<br />
Mon komt namelijk altijd voor Sat als je dat gewoon met een array.sortOn functie aanpakt.<br />
<br />
Uren gezocht op internet leverde geen eenvoudige oplossing op. Dus ben ik zelf wat gaan proberen.<br />
Uiteindelijk was het veel eenvoudiger dan ik had durven hopen.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:436px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #999999; font-style: italic;">//we maken een array met wat datums erin volgens het UTC format</span><span style="color: #6699cc; font-weight: bold;">var</span> arr<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a> = <span style="color: #000000;">&#91;</span><span style="color: #009900;">&quot;Tue Feb 23 00:11:49 +0000 2010&quot;</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #009900;">&quot;Sat Jan 24 22:14:29 +0000 2009&quot;</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #009900;">&quot;Wed Oct 28 19:41:35 +0000 2009&quot;</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #009900;">&quot;Sun Feb 21 19:39:10 +0000 2010&quot;</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #009900;">&quot;Sun Feb 21 19:39:11 +0000 2010&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>arr<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//we maken een lege array. &nbsp;Hierin maken we dalijk objecten met de datum in UTC string en in miliseconden.</span><span style="color: #6699cc; font-weight: bold;">var</span> arr1<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a target="_blank" href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//we lopen door de array met datum</span><span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> a <span style="color: #0033ff; font-weight: bold;">in</span> arr<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>	<span style="color: #999999; font-style: italic;">//hier maken we de objecten met UTC string en de tijd in miliseconden vanaf &nbsp;January 1, 1970, UTC.</span>	<span style="color: #999999; font-style: italic;">//uit de livedocs:</span>	<span style="color: #3f5fbf;">/*	* parse(date:String):Number	* [static] Converts a string representing a date into a number equaling the number of milliseconds elapsed since January 1, 1970, UTC.	*/</span>	arr1<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#123;</span> <span style="color: #004993;">date</span><span style="color: #000000; font-weight: bold;">:</span>arr<span style="color: #000000;">&#91;</span>a<span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #004993;">time</span><span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=date%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:date.html"><span style="color: #004993;">Date</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">parse</span><span style="color: #000000;">&#40;</span>arr<span style="color: #000000;">&#91;</span>a<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span><span style="color: #999999; font-style: italic;">//vervolgens sorteren we de nieuwe array op miliseconden. Het item met de hoogste waarde komt vooraan in de array te staan.</span>arr1<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">sortOn</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;time&quot;</span><span style="color: #000000; font-weight: bold;">,</span> <a target="_blank" href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">NUMERIC</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//we draaien de array om, we willen immers niet het oudste maar het recentste item vooraan hebben.</span>arr1<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">reverse</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">//en we loopen nog een keer door de array om te kijken of het gelukt is.</span><span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> a <span style="color: #0033ff; font-weight: bold;">in</span> arr1<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>	<span style="color: #999999; font-style: italic;">//we tracen het veld met de UTC string en concluderen dat het nog werkt ook :D</span>	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>arr1<span style="color: #000000;">&#91;</span>a<span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">date</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span></div></div></pre>
</div></div>

]]></content:encoded>
			<dc:creator>marcvz</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=37</guid>
		</item>
		<item>
			<title>3D Fractals</title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=36</link>
			<pubDate>Mon, 08 Feb 2010 20:29:17 GMT</pubDate>
			<description>Dit weekend heb ik wat zitten experimenteren met 3D fractals. 
 
 Image: http://www.neuroproductions.be/uploads/blog/examples/fractal/fractal1FF.jpg  
 
Maar in plaats van gewoon wat formules te copy-pasten an het internet, heb ik geprobeerd om zelf  
nieuwe volumes te vinden. En dat bleek eigenlijk niet zo moeilijk.  
Ze zijn natuurlijk niet zo spectaculair als de bekende mandelbulb (http://www.skytopia.com/project/fractal/mandelbulb.html)  en Julia fractals. Maar ik ben toch tevreden  
over...</description>
			<content:encoded><![CDATA[<div>Dit weekend heb ik wat zitten experimenteren met 3D fractals.<br />
<br />
 <img src="http://www.neuroproductions.be/uploads/blog/examples/fractal/fractal1FF.jpg" border="0" alt="" /><br />
<br />
Maar in plaats van gewoon wat formules te copy-pasten an het internet, heb ik geprobeerd om zelf <br />
nieuwe volumes te vinden. En dat bleek eigenlijk niet zo moeilijk. <br />
Ze zijn natuurlijk niet zo spectaculair als de bekende <a href="http://www.skytopia.com/project/fractal/mandelbulb.html" target="_blank">mandelbulb</a>  en Julia fractals. Maar ik ben toch tevreden <br />
over het resultaat. :)<br />
<br />
Om de volumes te renderen, heb ik een simpele (en trage :p ) ray-tracer gemaakt die normal-maps genereerd.<br />
 <br />
 <img src="http://www.neuroproductions.be/uploads/blog/examples/fractal/normalMapFractel_2FF.jpg" border="0" alt="" /><br />
 Daarna heb ik en Pixel Bender filter gebruikt om de shading op de renders te zetten.<br />
<br />
Een paar volumes die ik heb 'ontdekt':<br />
(Het bizare is dat het allemaal puur wiskundige vormen zijn)<br />
<br />
<img src="http://www.neuroproductions.be/uploads/blog/examples/fractal/fractal5FF.jpg" border="0" alt="" /><br />
<br />
<img src="http://www.neuroproductions.be/uploads/blog/examples/fractal/fractal4FF.jpg" border="0" alt="" /><br />
<br />
<img src="http://www.neuroproductions.be/uploads/blog/examples/fractal/fractal6FF.jpg" border="0" alt="" /><br />
<br />
<br />
Hierbij de <a href="http://www.neuroproductions.be/wp-content/plugins/download-monitor/download.php?id=24" target="_blank">source code</a> zodat je zelf ook kunt zoeken naar coole 3D vormen. :)</div>

]]></content:encoded>
			<dc:creator>Neuro</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=36</guid>
		</item>
		<item>
			<title>Custom Brushes met ActionScript</title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=35</link>
			<pubDate>Sun, 10 Jan 2010 13:43:31 GMT</pubDate>
			<description>Custom brushes in Flash, ik had ze al een paar keer tegen gekomen op het world wide interweb en steeds vroeg ik me af hoe ze dat deden. Dus heb ik dit weekend ook een poging gewaagd. 
 
 
Image: http://www.neuroproductions.be/uploads/ff/brushes/brushesFF.jpg  (http://www.neuroproductions.be/uploads/ff/brushes/BrushTest1.swf) 
 
» Bekijk de swf (http://www.neuroproductions.be/uploads/ff/brushes/BrushTest1.swf) 
 
Het resultaat is nog lang niet perfect, maar goed, voorlopig voldoende...  
...</description>
			<content:encoded><![CDATA[<div>Custom brushes in Flash, ik had ze al een paar keer tegen gekomen op het world wide interweb en steeds vroeg ik me af hoe ze dat deden. Dus heb ik dit weekend ook een poging gewaagd.<br />
<br />
<br />
<a href="http://www.neuroproductions.be/uploads/ff/brushes/BrushTest1.swf" target="_blank"><img src="http://www.neuroproductions.be/uploads/ff/brushes/brushesFF.jpg" border="0" alt="" /></a><br />
<font size="3"><br />
<a href="http://www.neuroproductions.be/uploads/ff/brushes/BrushTest1.swf" target="_blank">» Bekijk de swf</a><br />
</font><br />
Het resultaat is nog lang niet perfect, maar goed, voorlopig voldoende... <br />
<br />
<a href="http://www.neuroproductions.be/wp-content/plugins/download-monitor/download.php?id=22" target="_blank">Source code</a> (het is een puinhoop) :)<br />
<br />
<div align="center"><a href="http://www.neuroproductions.be/uploads/ff/blog/normals/ExSphereNormalMapTestOBJ.swf" target="_blank"><br />
</a></div></div>

]]></content:encoded>
			<dc:creator>Neuro</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=35</guid>
		</item>
		<item>
			<title>Een 64K in Flash</title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=34</link>
			<pubDate>Mon, 07 Dec 2009 20:22:21 GMT</pubDate>
			<description>Zo af en toe blader ik wel eens wat rond op scene.org, en hoewel dit eigenlijk weinig met Flash te maken heeft, kwam ik er vandaag toch iets tegen dat in Flash gemaakt is. 
 
Een korte introductie voor degenen die niet precies weten wat een 64K precies is: Een 64K is over het algemeen een programma van 64KB groot, die dankzij zeer goede compressie en programmeerwerk een animatie laat zien die tot wel enkele minuten kan duren (inclusief geluid!). 
 
Dus ik kwam nu een 64K tegen die niet een...</description>
			<content:encoded><![CDATA[<div>Zo af en toe blader ik wel eens wat rond op scene.org, en hoewel dit eigenlijk weinig met Flash te maken heeft, kwam ik er vandaag toch iets tegen dat in Flash gemaakt is.<br />
<br />
Een korte introductie voor degenen die niet precies weten wat een 64K precies is: Een 64K is over het algemeen een programma van 64KB groot, die dankzij zeer goede compressie en programmeerwerk een animatie laat zien die tot wel enkele minuten kan duren (inclusief geluid!).<br />
<br />
Dus ik kwam nu een 64K tegen die niet een win32 programma is, maar een swf. Ik zou zeggen, <a href="http://www.scene.org/file.php?file=%2Fparties%2F2009%2Fassembly09%2Fin64%2Fproof_of_concept_by_evoflash.zip&amp;fileinfo" target="_blank">neem eens een kijkje</a>, en vergeet vooral niet dat al dit moois uit een swf van slechts 64KB komt!</div>

]]></content:encoded>
			<dc:creator>dcm360</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=34</guid>
		</item>
		<item>
			<title>Mijn migratie naar AS3: width, height en coördinaten</title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=33</link>
			<pubDate>Sat, 28 Nov 2009 13:21:11 GMT</pubDate>
			<description>In een reeks blogs wil ik mijn migratie van ActionScript 2 naar 3 delen.  
Hier weer eventjes een praktisch voorbeeld van nog een verschil tussen ActionScript 2 en 3. 
 
Voorheen (in AS2) kon je de coördinaten van een MovieClip bepalen door naar de instantienaam te verwijzen en er een _x voor de horizontale en een _y voor de verticale coördinaat ernaast te zetten. 
 
mijnMovieClip_mc._x = 100; 
mijnMovieClip_mc._y = 100;In ActionScript 3 is het echter wat logischer gemaakt, door het *_* teken...</description>
			<content:encoded><![CDATA[<div>In een reeks blogs wil ik mijn migratie van ActionScript 2 naar 3 delen. <br />
Hier weer eventjes een praktisch voorbeeld van nog een verschil tussen ActionScript 2 en 3.<br />
<br />
Voorheen (in AS2) kon je de coördinaten van een MovieClip bepalen door naar de instantienaam te verwijzen en er een _x voor de horizontale en een _y voor de verticale coördinaat ernaast te zetten.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:68px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript" style="font-family:monospace;"><pre>mijnMovieClip_mc.<span style="color: #004993;">_x</span> = <span style="color: #000000; font-weight:bold;">100</span>;mijnMovieClip_mc.<span style="color: #004993;">_y</span> = <span style="color: #000000; font-weight:bold;">100</span>;</div></div></pre>
</div>In ActionScript 3 is het echter wat logischer gemaakt, door het <b>_</b> teken weg te laten.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:68px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre>mijnMovieClip_mc<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000; font-weight: bold;">;</span>mijnMovieClip_mc<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div>Dit maakt het allemaal wat makkelijker. Het stomme was dat als je dan een MovieClip afstemde op de width of height van de Stage dat het er een beetje verwarrend uit zag:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:68px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript" style="font-family:monospace;"><pre>mijnMovieClip_mc.<span style="color: #004993;">_x</span> = <span style="color: #004993;">Stage</span>.<span style="color: #004993;">width</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">2</span>;mijnMovieClip_mc.<span style="color: #004993;">_y</span> = <span style="color: #004993;">Stage</span>.<span style="color: #004993;">height</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">2</span>;</div></div></pre>
</div>De Stage.height of Stage.width werkte zonder het _ teken, maar bij een MovieClip moest je deze wel gebruiken.<br />
Nu is er voor de Stage.height en Stage.width ook iets veranderd:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:148px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #999999; font-style: italic;">// coördinaten </span>mijnMovieClip_mc<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #004993;">stage</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">stageWidth</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000; font-weight: bold;">;</span>mijnMovieClip_mc<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #004993;">stage</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">stageHeight</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #999999; font-style: italic;">// afmetingen</span>mijnMovieClip_mc<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">width</span> = <span style="color: #004993;">stage</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">stageWidth</span><span style="color: #000000; font-weight: bold;">;</span>mijnMovieClip_mc<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">height</span> = <span style="color: #004993;">stage</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">stageHeight</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div>Allemaal even wennen om het zo te doen, maar de manier van werken maakt het wel een stuk logischer! :D<br />
En voor mijn migratie van AS2 naar AS3: to be continued....</div>

]]></content:encoded>
			<dc:creator>tijmen_4real</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=33</guid>
		</item>
		<item>
			<title>Overstap van ActionScript 2 naar 3</title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=32</link>
			<pubDate>Tue, 17 Nov 2009 16:16:58 GMT</pubDate>
			<description>Ik zat dus al een tijdje te twijfelen om over te stappen van ActionScript 2 naar ActionScript 3. 
Nu ga ik dan toch over, en heb ik een duidelijke PDF gelezen van Adobe waarin in hoofdlijnen de verschillen tussen 2 en 3 worden behandeld. 
Om iedereen die ook nog twijfelt ook mee te krijgen schijf ik deze blog waarin ik de, althans voor mij, belangrijkste veranderingen bespreek. 
Eigenlijk is dit niet meer dan een directe vertaling van de Engelstalige PDF uit de bijlage, waar ik in heb geknipt...</description>
			<content:encoded><![CDATA[<div>Ik zat dus al een tijdje te twijfelen om over te stappen van ActionScript 2 naar ActionScript 3.<br />
Nu ga ik dan toch over, en heb ik een duidelijke PDF gelezen van Adobe waarin in hoofdlijnen de verschillen tussen 2 en 3 worden behandeld.<br />
Om iedereen die ook nog twijfelt ook mee te krijgen schijf ik deze blog waarin ik de, althans voor mij, belangrijkste veranderingen bespreek.<br />
Eigenlijk is dit niet meer dan een directe vertaling van de Engelstalige PDF uit de bijlage, waar ik in heb geknipt en geplakt.<br />
<br />
De onderstaande voorbeelden laten eerste de werkwijze in AS2 zien met daaronder de nieuwe werkwijze in AS3.<br />
<br />
<b>Voorbeeld 1: Naar een functie op de _root/main timeline verwijzen</b><br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:148px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript" style="font-family:monospace;"><pre><span style="color: #009900; font-style: italic;">// de functie op de main timeline</span><span style="color: #0033ff; font-weight: bold;">function</span> dumber<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #004993;">Void</span> <span style="color: #000000;">&#123;</span>	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;dumber&quot;</span><span style="color: #000000;">&#41;</span>;<span style="color: #000000;">&#125;</span><span style="color: #009900; font-style: italic;">// aanroepen vanuit ergens in je content</span><span style="color: #004993;">_root</span>.<span style="color: #000000;">dumber</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div></div></pre>
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:148px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #999999; font-style: italic;">// de functie op de main timeline</span><span style="color: #339966; font-weight: bold;">function</span> dumber<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span>Void <span style="color: #000000;">&#123;</span>	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;dumber&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span><span style="color: #999999; font-style: italic;">// aanroepen vanuit ergens in je content</span><a target="_blank" href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a><span style="color: #000000;">&#40;</span><span style="color: #004993;">root</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">.</span>dumber<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><b>Voorbeeld 2: Met interactiviteit van buttons omgaan<br />
<br />
</b><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:196px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript" style="font-family:monospace;"><pre><span style="color: #0033ff; font-weight: bold;">function</span> onButtonRelease<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #004993;">Void</span> <span style="color: #000000;">&#123;</span>	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;er is op de button geklikt&quot;</span><span style="color: #000000;">&#41;</span>;<span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">function</span> onButtonRollOver<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #004993;">Void</span> <span style="color: #000000;">&#123;</span>	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;de muis ging over de button heen&quot;</span><span style="color: #000000;">&#41;</span>;<span style="color: #000000;">&#125;</span>mijnButton_btn.<span style="color: #004993;">onRelease</span> = onButtonRelease;mijnButton_btn.<span style="color: #004993;">onRollOver</span>= onButtonRollOver;</div></div></pre>
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:196px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #339966; font-weight: bold;">function</span> onButtonClick<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;er is op de button geklikt&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span><span style="color: #339966; font-weight: bold;">function</span> onMouseOver<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;de muis ging over de button heen&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span>mijnButton_btn<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a target="_blank" href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000000; font-weight: bold;">,</span> onButtonClick<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>mijnButton_btn<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a target="_blank" href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_OVER</span><span style="color: #000000; font-weight: bold;">,</span> onMouseOver<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><b>Voorbeeld 3: Een link openen<br />
<br />
</b><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:52px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript" style="font-family:monospace;"><pre><span style="color: #004993;">getURL</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;http://www.google.nl&quot;</span>,<span style="color: #009900;">&quot;_blank&quot;</span><span style="color: #000000;">&#41;</span>;</div></div></pre>
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:68px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">url</span><span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=urlrequest%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:urlrequest.html"><span style="color: #004993;">URLRequest</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a target="_blank" href="http://www.google.com/search?q=urlrequest%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:urlrequest.html"><span style="color: #004993;">URLRequest</span></a><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;http://www.google.nl&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #004993;">navigateToURL</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">url</span><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #009900;">&quot;_blank&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><b>Voorbeeld 4: Een keypress opvangen</b><br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:148px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript" style="font-family:monospace;"><pre><span style="color: #0033ff; font-weight: bold;">function</span> <span style="color: #004993;">onKeyDown</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #004993;">Void</span> <span style="color: #000000;">&#123;</span>	<span style="color: #0033ff; font-weight: bold;">var</span> code:<span style="color: #004993;">Number</span> = <span style="color: #004993;">Key</span>.<span style="color: #004993;">getCode</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;	<span style="color: #0033ff; font-weight: bold;">var</span> char:<span style="color: #004993;">String</span> = <span style="color: #004993;">String</span>.<span style="color: #004993;">fromCharCode</span><span style="color: #000000;">&#40;</span>code<span style="color: #000000;">&#41;</span>;	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;Ingedrukte key : code : &quot;</span> + code + <span style="color: #009900;">&quot;char : &quot;</span> + char<span style="color: #000000;">&#41;</span>;<span style="color: #000000;">&#125;</span><span style="color: #004993;">Key</span>.<span style="color: #004993;">addListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">this</span><span style="color: #000000;">&#41;</span>;</div></div></pre>
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:148px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #339966; font-weight: bold;">function</span> onKeyDownHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=keyboardevent%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:keyboardevent.html"><span style="color: #004993;">KeyboardEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>	<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">code</span><span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = event<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">keyCode</span><span style="color: #000000; font-weight: bold;">;</span>	<span style="color: #6699cc; font-weight: bold;">var</span> char<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <a target="_blank" href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">fromCharCode</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">code</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;Ingedrukte key : code : &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">code</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #009900;">&quot;char : &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> char<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #000000;">&#125;</span><span style="color: #004993;">stage</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a target="_blank" href="http://www.google.com/search?q=keyboardevent%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:keyboardevent.html"><span style="color: #004993;">KeyboardEvent</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">KEY_UP</span><span style="color: #000000; font-weight: bold;">,</span> onKeyDownHandler<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div><b>Voorbeeld 5: Een MovieClip dynamisch toevoegen vanuit de Library/Bibliotheek<br />
<br />
</b><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:116px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript" style="font-family:monospace;"><pre><span style="color: #004993;">attachMovie</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;mijnMovie&quot;</span>, <span style="color: #009900;">&quot;clip&quot;</span>, 10<span style="color: #000000;">&#41;</span>;clip.<span style="color: #004993;">_x</span> = <span style="color: #000000; font-weight:bold;">100</span>;clip.<span style="color: #004993;">_y</span> = <span style="color: #000000; font-weight:bold;">100</span>;clip.<span style="color: #004993;">_alpha</span> = <span style="color: #000000; font-weight:bold;">50</span>;</div></div></pre>
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:164px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> clip<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> mijnMovie<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>clip<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000; font-weight: bold;">;</span>clip<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000; font-weight: bold;">;</span>clip<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">alpha</span> = <span style="color: #000000; font-weight: bold;">.</span>5<span style="color: #000000; font-weight: bold;">;</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>clip<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span></div></div></pre>
</div>Dit waren 5 voorbeelden van verandering als je overstapt van AS2 naar AS3.<br />
Je vindt nog meer voorbeelden in de bijlage, het originele Migration CookBook van Adobe.<br />
<br />
<font size="1">Er zullen ongetwijfeld een aantal typfouten in bovenstaand artikel staan. Mijn excuses hiervoor ;)....</font></div>


<!-- attachments -->
	<div style="margin-top:10px">

		
		
		
		
			<fieldset class="fieldset">
				<legend>Bijgevoegde bestanden</legend>
				<table cellpadding="0" cellspacing="3" border="0">
				<tr>
	<td><img class="inlineimg" src="http://www.flashfocus.nl/forum/images/attach/pdf.gif" alt="Bestandstype: pdf" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
	<td><a href="http://www.flashfocus.nl/forum/blog_attachment.php?attachmentid=2&amp;d=1258472764">BA843910d01.pdf</a> (599,3 KB, 280x geopend)</td>
</tr>
				</table>
			</fieldset>
		

	</div>
<!-- / attachments -->
]]></content:encoded>
			<dc:creator>tijmen_4real</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=32</guid>
		</item>
		<item>
			<title><![CDATA[Chain [updated]]]></title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=31</link>
			<pubDate>Sat, 14 Nov 2009 12:22:28 GMT</pubDate>
			<description><![CDATA[Ik heb een handige util class geschreven die ik graag met jullie wil delen. Het is om functies met verschillende intervallen (in ms) in een sequence aan te roepen. De 'Chain' kan gemakkelijk meerdere keren afgespeeld worden, zelfs in omgekeerde volgorde. :D 
 
Bij deze een klein voorbeeldje, hoe je Chain kan gebruiken: 
 
var myChain:Chain = new Chain();     
myChain.addEventListener( Event.COMPLETE, onComplete); 
myChain.add(one, 2000).add(two, 500).add(three, 1000).play(2); 
 
function...]]></description>
			<content:encoded><![CDATA[<div><div align="left">Ik heb een handige util class geschreven die ik graag met jullie wil delen. Het is om functies met verschillende intervallen (in ms) in een sequence aan te roepen. De 'Chain' kan gemakkelijk meerdere keren afgespeeld worden, zelfs in omgekeerde volgorde. :D<br />
<br />
Bij deze een klein voorbeeldje, hoe je Chain kan gebruiken:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:228px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #6699cc; font-weight: bold;">var</span> myChain<span style="color: #000000; font-weight: bold;">:</span>Chain = <span style="color: #0033ff; font-weight: bold;">new</span> Chain<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span> &nbsp; &nbsp;myChain<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <a target="_blank" href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">COMPLETE</span><span style="color: #000000; font-weight: bold;">,</span> onComplete<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span>myChain<span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span>one<span style="color: #000000; font-weight: bold;">,</span> 2000<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span>two<span style="color: #000000; font-weight: bold;">,</span> 500<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span>three<span style="color: #000000; font-weight: bold;">,</span> 1000<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">.</span><span style="color: #004993;">play</span><span style="color: #000000;">&#40;</span>2<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #339966; font-weight: bold;">function</span> one<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span> <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;one&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><span style="color: #339966; font-weight: bold;">function</span> two<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span> <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;two&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><span style="color: #339966; font-weight: bold;">function</span> three<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span> <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;three&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><span style="color: #339966; font-weight: bold;">function</span> onComplete<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span> <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;done.&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><span style="color: #3f5fbf;">/* trace output:one two three one two three done.*/</span></div></div></pre>
</div>Wat gebeurt hier? Op de eerste regel maken we de classe Chain aan.Op de volgende regel gebeuren meerdere dingen: We roepen een <i>add</i>-function aan. Dit is een belangrijk onderdeel in de class. Hier geef je aan na hoeveel delay er is voor de volgende functie, en welke functie er nu uitgevoerd moet worden. <i>add(one,</i><i>2000</i><i>);</i> betekent dus dat functie 1 wordt uitgevoerd en dat er daarna 2 seconden gewacht moet worden voor de volgende functie. Zo gaat hij door met de volgende functies.<br />
Aan het einde zie je de <i>play</i>-functie. Wat aangeeft dat er vanaf dat punt de functies uitgevoerd gaan worden, hoeveel keer het herhaald wordt. Daarna wordt het event COMPLETE dispatched.<br />
Je kunt met deze classe dus je eigen patronen,sequenties en/of ritmes maken. <br />
<br />
Ik ben een beetje geïnspireerd door jQuery (wat hier niets mee te maken heeft), om de mogelijkheid te geven om <i>add</i>-functies achter  elkaar te plakken.<br />
<br />
Dat is wat de classe doet. Een koel ding vind ik dat je het ook in omgekeerde volgorde kunt afspelen:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:116px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre>myChain<span style="color: #000000; font-weight: bold;">.</span>playReversed<span style="color: #000000;">&#40;</span>2<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">;</span><span style="color: #3f5fbf;">/* trace output:three two one three two one*/</span></div></div></pre>
</div> Natuurlijk kunt je ook tussentijds stoppen/doorgaan met de <i>stop() / doContinue()</i> functies, en je kunt nagaan of hij momenteel afspeelt met de <i>isPlaying</i>-getter<br />
<br />
Dit zijn alle functies:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript 3 Code:</div>
	<pre class="alt2" style="margin:0px; padding:5px; border: 1px solid #B1B6C2; width:700px; height:484px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript3" style="font-family:monospace;"><pre><span style="color: #999999; font-style: italic;">/// Constructor</span><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Chain<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #999999; font-style: italic;">/// Voeg functies toe met een specifieke interval (in milliseconden).</span><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span>func<span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=function%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:function.html"><span style="color: #004993;">Function</span></a><span style="color: #000000; font-weight: bold;">,</span> <span style="color: #004993;">delay</span><span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span>Chain<span style="color: #999999; font-style: italic;">/// Speel de &nbsp;sequence af en roep de functies aan.</span><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">play</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">repeatCount</span><span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = 0<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #999999; font-style: italic;">/// Speel de &nbsp;sequence in omgekeerde volgorde af en roep de functies aan.</span><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> playReversed<span style="color: #000000;">&#40;</span><span style="color: #004993;">repeatCount</span><span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = 0<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #999999; font-style: italic;">/// Maakt sequest lijst leeg. Alle data wordt leeggemaakt</span><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span>Chain<span style="color: #999999; font-style: italic;">/// Stop met spelen, gebruik doContinue() om verder te spelen</span><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #999999; font-style: italic;">/// Doorspelen na een stop </span><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> doContinue<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span>Chain<span style="color: #999999; font-style: italic;">/// Reset indexen om naar begin te springen</span><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">reset</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">toString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #999999; font-style: italic;">/// Retourneerd of je momenteel aan het afspelen bent</span><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> isPlaying<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><a target="_blank" href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/3/langref/%20inurl:boolean.html"><span style="color: #004993;">Boolean</span></a></div></div></pre>
</div><b>Download:</b> <a href="http://code.google.com/p/stroep/source/browse/#svn/trunk/nl/stroep/chain" target="_blank">Chain</a> (googlecode)<br />
<br />
Ik hoop dat iemand er wat mee kan. Laat maar weten als je nog extra functies verwacht<br />
<br />
<b>updates 15-nov-'09</b><br />
- private functions zijn protected<br />
- add function is nu add(func,delay), dus andersom, en func is verplicht.<br />
- Classe extend EventDispatcher en play/playReversed dispatchen Event.COMPLETE na afspelen van sequence<br />
- code geoptimaliseerd/opgeschoont.<br />
</div></div>

]]></content:encoded>
			<dc:creator>mknol</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=31</guid>
		</item>
		<item>
			<title>getBounds voor TextFields</title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=30</link>
			<pubDate>Thu, 05 Nov 2009 19:45:05 GMT</pubDate>
			<description>Ik kwam erachter dat getBounds op een textfield niet de Rectangle teruggaf die ik verwacht :( Hij pakt namenlijk de omgrenzing  van de background/border, ook al heb je die niet eens aan staan. Ik wilde zelf echt puur de omgrenzing van de tekst hebben. Ik heb hier een functie voor geschreven. Ik maak hier gebruik van getColorBoundsRect van een bitmapdata object. :) 
 
Bekijk hier het voorbeeld (op mijn blog) 
http://blog.stroep.nl/2009/11/getbitmapbounds/</description>
			<content:encoded><![CDATA[<div>Ik kwam erachter dat getBounds op een textfield niet de Rectangle teruggaf die ik verwacht :( Hij pakt namenlijk de omgrenzing  van de background/border, ook al heb je die niet eens aan staan. Ik wilde zelf echt puur de omgrenzing van de tekst hebben. Ik heb hier een functie voor geschreven. Ik maak hier gebruik van getColorBoundsRect van een bitmapdata object. :)<br />
<br />
Bekijk hier het voorbeeld (op mijn blog)<br />
<a href="http://blog.stroep.nl/2009/11/getbitmapbounds/" target="_blank">http://blog.stroep.nl/2009/11/getbitmapbounds/</a></div>

]]></content:encoded>
			<dc:creator>mknol</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=30</guid>
		</item>
		<item>
			<title>Automatische code indentatie en copy-paste bug</title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=29</link>
			<pubDate>Tue, 03 Nov 2009 23:59:29 GMT</pubDate>
			<description>Hallo, 
 
Met de overstap naar de laatste versie van vbulletin werd ook heel de code highlighter onder handen genomen (http://www.flashfocus.nl/forum/blog.php?b=4). Er waren toen echter nog enkele bugs: Zo werden linebreaks niet mee gekopieerd bij het copy-pasten van een volledig code blok en was er geen automatische indentatie, iets wat we vroeger wel hadden. 
 
Na lang zwoegen, testen en hacken is het ons toch gelukt om deze twee problemen van de baan te schuiven. Vanaf nu kan je volledige...</description>
			<content:encoded><![CDATA[<div>Hallo,<br />
<br />
Met de overstap naar de laatste versie van vbulletin werd ook heel de <a href="http://www.flashfocus.nl/forum/blog.php?b=4" target="_blank">code highlighter onder handen genomen</a>. Er waren toen echter nog enkele bugs: Zo werden linebreaks niet mee gekopieerd bij het copy-pasten van een volledig code blok en was er geen automatische indentatie, iets wat we vroeger wel hadden.<br />
<br />
Na lang zwoegen, testen en hacken is het ons toch gelukt om deze twee problemen van de baan te schuiven. Vanaf nu kan je volledige stukken code vlekkeloos kopiëren en worden talen die gebruik maken van accolades ({ en }) automatisch van indentatie voorzien.<br />
<br />
Happy coding!</div>

]]></content:encoded>
			<dc:creator>Dauntless</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=29</guid>
		</item>
		<item>
			<title>Tutorial voor een basic image viewer (in de oktober editie van Publish)</title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=28</link>
			<pubDate>Fri, 30 Oct 2009 20:08:54 GMT</pubDate>
			<description><![CDATA[Ik mocht voor Publish (http://publish.nl) (sponsor van de zomercompetitie (http://flashfocus.nl/forum/showthread.php?goto=newpost&t=54139)) een workshop schrijven over hoe je een basic image viewer maakt. 
 
In de oktober-uitgave (die eerder deze week verschenen is) kun je deze tutorial volgen. 
 
Voor de geinteresseerden: het magazine is zijn geld (±12€/uitgave) meer dan waard. ;) 
 
Image: http://nocreativity.com/blog/wp-content/uploads/2009/10/page1.jpg  
 
Image:...]]></description>
			<content:encoded><![CDATA[<div>Ik mocht voor <a href="http://publish.nl" target="_blank">Publish</a> (sponsor van de <a href="http://flashfocus.nl/forum/showthread.php?goto=newpost&amp;t=54139" target="_blank">zomercompetitie</a>) een workshop schrijven over hoe je een basic image viewer maakt.<br />
<br />
In de oktober-uitgave (die eerder deze week verschenen is) kun je deze tutorial volgen.<br />
<br />
Voor de geinteresseerden: het magazine is zijn geld (±12€/uitgave) meer dan waard. ;)<br />
<br />
<img src="http://nocreativity.com/blog/wp-content/uploads/2009/10/page1.jpg" border="0" alt="" /><br />
<br />
<img src="http://nocreativity.com/blog/wp-content/uploads/2009/10/page2.jpg" border="0" alt="" /><br />
<br />
<img src="http://nocreativity.com/blog/wp-content/uploads/2009/10/page3.jpg" border="0" alt="" /><br />
<br />
Er werden ook wat foto's van <a href="http://www.flickr.com/photos/babycreative/" target="_blank">mijn Flickr page</a> getoond. (Ja, ik ben uiterst trots :D )<br />
<br />
Beetje meer info kun je <a href="http://nocreativity.com/blog/i-got-publish-ed" target="_blank">hier</a> lezen (in het Engels)<br />
Dit wou ik even meedelen ^^</div>

]]></content:encoded>
			<dc:creator>Ea.Z</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=28</guid>
		</item>
		<item>
			<title>Updates via Twitter</title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=26</link>
			<pubDate>Wed, 28 Oct 2009 22:46:20 GMT</pubDate>
			<description>Vanaf vandaag worden updates van de site automatisch naar Twitter (http://twitter.com/FlashFocus) gepost. Momenteel geldt dit voor Nieuws, Showcase items en Freaking sites. 
 
Mochten jullie nog andere dingen op twitter gepost willen zien, of suggesties hebben voor andere manieren waarop updates naar buiten gebracht kunnen worden horen we dat graag!</description>
			<content:encoded><![CDATA[<div>Vanaf vandaag worden updates van de site automatisch naar <a href="http://twitter.com/FlashFocus" target="_blank">Twitter</a> gepost. Momenteel geldt dit voor Nieuws, Showcase items en Freaking sites.<br />
<br />
Mochten jullie nog andere dingen op twitter gepost willen zien, of suggesties hebben voor andere manieren waarop updates naar buiten gebracht kunnen worden horen we dat graag!</div>

]]></content:encoded>
			<dc:creator>Tha Narie</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=26</guid>
		</item>
		<item>
			<title><![CDATA[[Tutorial] Cloth-Twist spin in After Effects]]></title>
			<link>http://www.flashfocus.nl/forum/blog.php?b=25</link>
			<pubDate>Fri, 16 Oct 2009 23:25:49 GMT</pubDate>
			<description><![CDATA[Ik was daarnet 4 uur lang op zoek naar een oplossing voor een heel makkelijk effect. Echter is uitleg daarvoor vinden uiterst moeilijk. Ook ben ik op allerlei plugins voor AE gestoten die hopen geld kosten, en waar ik niets aan had... Uiteindelijk heb ik de oplossing gevonden maar ik vond het iets TE gemakkelijk om jullie in het duister te laten... 
 
*Korte uitleg:* 
Wat we hier gaan doen is een object rond zijn Y-as laten draaien. Maar op zich gebeurt dat vrij 'stijf' (zie plaatje) 
Image:...]]></description>
			<content:encoded><![CDATA[<div>Ik was daarnet 4 uur lang op zoek naar een oplossing voor een heel makkelijk effect. Echter is uitleg daarvoor vinden uiterst moeilijk. Ook ben ik op allerlei plugins voor AE gestoten die hopen geld kosten, en waar ik niets aan had... Uiteindelijk heb ik de oplossing gevonden maar ik vond het iets TE gemakkelijk om jullie in het duister te laten...<br />
<br />
<font color="DimGray"><font size="4"><b>Korte uitleg:</b></font></font><br />
Wat we hier gaan doen is een object rond zijn Y-as laten draaien. Maar op zich gebeurt dat vrij 'stijf' (zie plaatje)<br />
<img src="http://shots.nocreativity.com/screenshot_2009-10-17_at_01_05_54.jpg" border="0" alt="" /><br />
<br />
Dit wil ik (we?) niet. We willen een beetje verbuiging tijdens het draaien, alsof de onderkant niet direct kan volgen. (zie plaatje)<br />
<img src="http://shots.nocreativity.com/screenshot_2009-10-17_at_01_07_30.jpg" border="0" alt="" /><br />
<br />
<br />
<font color="DimGray"><font size="4"><b>Hoe doen we dat?</b></font></font><br />
<br />
<b><font size="3">1.</font></b><br />
Maak een composition (a) met daarin je te draaien onderwerp (ik heb hier het Devine logo gepakt). Enable de 3D switch, en maak een korte animatie waarbij je je item rond de y as draait over een aantal seconden tijd heen (zodat je later het effect duidelijk kunt zien) (ik ga ervan uit dat je weet hoe je dit moet doen)<br />
<img src="http://shots.nocreativity.com/screenshot_2009-10-17_at_00_55_37.jpg" border="0" alt="" /><br />
<br />
<b><font size="3">2.</font></b><br />
Maak nog een composition (b). plaats hier een gradient in. Orienteer hem verticaal (zodat de gradient van wit (boven) naar zwart (beneden) overloopt<br />
<img src="http://shots.nocreativity.com/screenshot_2009-10-17_at_00_57_32.jpg" border="0" alt="" /><br />
<br />
<b><font size="3">3.</font></b><br />
Maak nu een laaste composition (c). Plaats hier eerst de gradient composition (b) in. Plaats de logo composition (a) erboven.<br />
<br />
<b><font size="3">4.</font></b><br />
Rechtsklik de logo layer, en kies voor 'Effects &gt;Time &gt; Time displacement'.<br />
<img src="http://shots.nocreativity.com/screenshot_2009-10-17_at_18_45_29.jpg" border="0" alt="" /><br />
<br />
<b><font size="3">5.</font></b><br />
Ga naar de instellingen van de Time Displacement in de 'logo'-layer (a) effects. Bij de instelling 'Time Displacement Layer' kies je voor de gradient layer (deze waar de b composition op staat ;) )<br />
<img src="http://shots.nocreativity.com/screenshot_2009-10-17_at_01_01_17.jpg" border="0" alt="" /><br />
<br />
<b><font size="3">6.</font></b><br />
Bekijk nu de RAM preview. Je zult zien dat het stijve vlak van daarnet nu wat verbuigt tijdens het draaien. Speel met de Time Displacement settings tot je het naar je zin hebt :)<br />
<br />
<b>Final tip:</b> Als je die gradient niet meer wilt zien kun je in deze comp (c) de gradient layer gewoon onzichtbaar maken ;) Time remapping zal nog altijd werken, en de gradient is niet meer zichtbaar.<br />
<img src="http://shots.nocreativity.com/screenshot_2009-10-17_at_01_18_10.jpg" border="0" alt="" /><br />
<br />
<font size="1">Dit is natuurlijk maar één manier van de inzetbaarheid van Time Remapping. Ik kan me zeker voorstellen dat er nog veel meer leuke toepassingen zijn waar dit van pas kan komen. <br />
Wat je hiervan moet onthouden is dat je time remapping kunt uitvoeren aan de hand van gradients. De snelheid van de gradient en de settings in de Time Displacement options laten je hierover heel wat controle hebben.</font><br />
<br />
Veel plezier ermee. <br />
Als er vragen zijn: kom maar op</div>

]]></content:encoded>
			<dc:creator>Ea.Z</dc:creator>
			<guid isPermaLink="true">http://www.flashfocus.nl/forum/blog.php?b=25</guid>
		</item>
	</channel>
</rss>
