<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Arie de Bonth</title>
	<atom:link href="http://www.bonth.nl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bonth.nl</link>
	<description>Flash &#38; Actionscript specialist</description>
	<lastBuildDate>Sun, 04 Mar 2012 11:17:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>AS3 clickTag &amp; IE popup blocker</title>
		<link>http://www.bonth.nl/2011/12/19/as3-clicktag-ie-popup-blocker/</link>
		<comments>http://www.bonth.nl/2011/12/19/as3-clicktag-ie-popup-blocker/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 20:29:07 +0000</pubDate>
		<dc:creator>Arie</dc:creator>
				<category><![CDATA[actionscript]]></category>

		<guid isPermaLink="false">http://www.bonth.nl/?p=552</guid>
		<description><![CDATA[Recently, we at Gynzy had to implement clickTag scripts in Actionscript 3 banners. As you might know, AS 3 banners don&#8217;t work well in Internet Explorer. You&#8217;ll get a pop-up blocked warning when using navigateToURL(). After some googling I found a clickTag script at blog.advalidation.com/2011/06/as3-clicktag.html It uses ExternalInterface.call('window.open', url, '_blank'); when the user agent of the [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, we at <a href="http://www.gynzy.com/">Gynzy</a> had to implement clickTag scripts in Actionscript 3 banners. As you might know, AS 3 banners don&#8217;t work well in Internet Explorer. You&#8217;ll get a pop-up blocked warning when using navigateToURL().</p>
<p>After some googling I found a clickTag script at<br />
<a href="http://blog.advalidation.com/2011/06/as3-clicktag.html">blog.advalidation.com/2011/06/as3-clicktag.html</a><br />
It uses <code>ExternalInterface.call('window.open', url, '_blank');</code> when the user agent of the banner is MSIE. This script worked almost perfect, it only had two requirements:<br />
1) AllowScriptAccess needs to be true either by setting it to &#8220;always&#8221; or by setting it to &#8220;sameDomain&#8221; and loading the flash from the same domain as the hosting page.<br />
2) The .swf file has to be embedded in html.</p>
<p>If the requirements are not met, actionscript will throw an error without opening the requested url (only in Internet Explorer of course). I tried to work around this problem by catching the error and use navigateToURL in case ExternalInterface.call fails. See my script below:<br />
<span id="more-552"></span></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> handleClick<span style="color: #66cc66;">&#40;</span>mouseEvent:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #000000; font-weight: bold;">var</span> interactiveObject:InteractiveObject = mouseEvent.<span style="color: #0066CC;">target</span> as InteractiveObject;
  <span style="color: #000000; font-weight: bold;">var</span> li:LoaderInfo = LoaderInfo<span style="color: #66cc66;">&#40;</span>interactiveObject.<span style="color: #006600;">root</span>.<span style="color: #006600;">loaderInfo</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">url</span>:<span style="color: #0066CC;">String</span> = li.<span style="color: #006600;">parameters</span>.<span style="color: #006600;">clickTag</span>;
  <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">url</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>ExternalInterface.<span style="color: #006600;">available</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      <span style="color: #0066CC;">try</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">var</span> userAgent:<span style="color: #0066CC;">String</span> = ExternalInterface.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'function(){ return navigator.userAgent; }'</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>userAgent <span style="color: #66cc66;">&amp;</span>amp;<span style="color: #66cc66;">&amp;</span>amp; userAgent.<span style="color: #0066CC;">indexOf</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;MSIE&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&amp;</span>gt;= <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
          ExternalInterface.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'window.open'</span>, <span style="color: #0066CC;">url</span>, <span style="color: #ff0000;">'_blank'</span><span style="color: #66cc66;">&#41;</span>;
          <span style="color: #b1b100;">return</span>;
        <span style="color: #66cc66;">&#125;</span>
      <span style="color: #66cc66;">&#125;</span> <span style="color: #0066CC;">catch</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:<span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #808080; font-style: italic;">//</span>
      <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
    navigateToURL<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">url</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #ff0000;">'_blank'</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
myButton_btn.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, handleClick<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>To test my script in Internet Explorer, open: <a href="http://www.bonth.nl/wordpress/wp-content/uploads/2011-12-18-as3clicktag/as3_clicktag.html" target="_blank">as3_clicktag.html<br />
</a>(ideal situation, script will use ExternalInterface.call)</p>
<p>The same banner with allowscriptaccess set to never: <a href="http://www.bonth.nl/wordpress/wp-content/uploads/2011-12-18-as3clicktag/as3_clicktag_no_scriptaccess.html" target="_blank">as3_clicktag_no_scriptaccess.html<br />
</a>(script will use navigateToURL instead of ExternalInterface.call)</p>
<p>And the swf file without html: <a href="http://www.bonth.nl/wordpress/wp-content/uploads/2011-12-18-as3clicktag/as3_clicktag_fixed_url.swf" target="_blank">as3_clicktag_fixed_url.swf</a></p>
<p>In case you&#8217;re interested in the source files: <a href="http://www.bonth.nl/wordpress/wp-content/uploads/2011-12-18-as3clicktag/as3_clicktag.zip" target="_blank">as3_clicktag.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bonth.nl/2011/12/19/as3-clicktag-ie-popup-blocker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 Object shuffle or randomize</title>
		<link>http://www.bonth.nl/2011/05/29/as3-object-shuffle-or-randomize/</link>
		<comments>http://www.bonth.nl/2011/05/29/as3-object-shuffle-or-randomize/#comments</comments>
		<pubDate>Sun, 29 May 2011 20:58:43 +0000</pubDate>
		<dc:creator>Arie</dc:creator>
				<category><![CDATA[actionscript]]></category>

		<guid isPermaLink="false">http://www.bonth.nl/?p=485</guid>
		<description><![CDATA[After I published my AS3 Vector shuffle or randomize post, Philip Bulley commented: &#8220;&#8230;I tried casting a Vector.int to Vector.*, but the vector becomes null within the shuffle method&#8221;. I never had to randomize a Vector.&#60;int&#62; but when I tried I discovered Philip was right, the result was null. I solved this problem by changing my shuffleVector function [...]]]></description>
			<content:encoded><![CDATA[<p>After I published my <a title="AS3 Vector shuffle or randomize" href="http://www.bonth.nl/2010/07/25/as3-vector-shuffle-or-randomize/">AS3 Vector shuffle or randomize</a> post, <a title="Philip Bulley" rel="external nofollow" href="http://www.milkisevil.com/blog">Philip Bulley</a> commented: &#8220;<em>&#8230;I tried casting a Vector.int to Vector.*, but the vector becomes null within the shuffle method&#8221;</em>. I never had to randomize a Vector.&lt;int&gt; but when I tried I discovered Philip was right, the result was null.</p>
<p>I solved this problem by changing my shuffleVector function into a more generic shuffleObject function. It solves all casting problems and you can use the shuffleObject function to randomize Objects, Array and Vectors. So if you want to randomize or shuffle an Object, Array or Vector, please use this function below instead of my previous shuffleVector function.<br />
<span id="more-485"></span></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/**
 * Shuffles object with Fisher-Yates shuffle algorithm using Math.random
 * @param obj
 * example code to shuffle a vector: ObjectUtils.shuffleObject(myVector);
 */</span>
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> shuffleObject<span style="color: #66cc66;">&#40;</span>obj:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = obj.<span style="color: #0066CC;">length</span>;
	<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>i <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> j:<span style="color: #0066CC;">int</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> i<span style="color: #66cc66;">&#41;</span>;
		i--;
		<span style="color: #000000; font-weight: bold;">var</span> temp:<span style="color: #66cc66;">*</span> = obj<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;
		obj<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = obj<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>;
		obj<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span> = temp;
	<span style="color: #66cc66;">&#125;</span>				
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>At <a href="http://www.gynzy.com">Gynzy</a> we often use <a href="http://www.gskinner.com/blog/archives/2008/01/source_code_see.html">com.gskinner.utils.Rndm</a> class because it generates random numbers based on a seed number. Necessary if you want to reproduce a random output.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/**
 * Shuffles object with Fisher-Yates shuffle algorithm
 * using com.gskinner.utils.Rndm class
 * @param obj
 * example code to shuffle a vector: ObjectUtils.shuffleObject(myVector);
 */</span>
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> shuffleObjectRndm<span style="color: #66cc66;">&#40;</span>obj:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = obj.<span style="color: #0066CC;">length</span>;
	<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>i <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> j:<span style="color: #0066CC;">int</span> = Rndm.<span style="color: #006600;">integer</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, i<span style="color: #66cc66;">&#41;</span>;
		i--;
		<span style="color: #000000; font-weight: bold;">var</span> temp:<span style="color: #66cc66;">*</span> = obj<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;
		obj<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = obj<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>;
		obj<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span> = temp;
	<span style="color: #66cc66;">&#125;</span>				
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>I really appreciate the Fisher-Yates shuffle algorithm, but I had to read <a href="http://www.codinghorror.com/blog/2007/12/the-danger-of-naivete.html">this article</a> to fully understand why it&#8217;s superior to a naive shuffle algorithm.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bonth.nl/2011/05/29/as3-object-shuffle-or-randomize/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>TextSnapshot.getTextRunInfo: where is corner0x?</title>
		<link>http://www.bonth.nl/2011/05/05/textsnapshot-gettextruninfo-where-is-corner0x/</link>
		<comments>http://www.bonth.nl/2011/05/05/textsnapshot-gettextruninfo-where-is-corner0x/#comments</comments>
		<pubDate>Thu, 05 May 2011 13:40:47 +0000</pubDate>
		<dc:creator>Arie</dc:creator>
				<category><![CDATA[actionscript]]></category>

		<guid isPermaLink="false">http://www.bonth.nl/?p=475</guid>
		<description><![CDATA[For a new Gynzy tool, I&#8217;m trying to detect coordinates of selected words in a static textfield. It&#8217;s not to difficult using the TextSnapshot object. The]]></description>
			<content:encoded><![CDATA[<p>For a new <a href="http://www.gynzy.com/" target="_blank">Gynzy</a> tool, I&#8217;m trying to detect coordinates of selected words in a static textfield. It&#8217;s not to difficult using the <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextSnapshot.html" target="_blank">TextSnapshot</a> object. The <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextSnapshot.html#getTextRunInfo() target="_blank">getTextRunInfo</a> method returns an array of objects in which each object contains information about a specific character, including corner0x, corner0y, corner1x, corner1y, corner2x, corner2y, corner3x, and corner3y (the corners of the bounding box of the character).</p>
<p>It was a bit of a puzzle how to use these values, because Adobe didn&#8217;t document where corner 0, 1, 2 or 3 is situated.  That&#8217;s why I&#8217;m publishing this list:</p>
<ul>
<li>corner0x &#038; corner0y : bottom left corner</li>
<li>corner1x &#038; corner1y : bottom right corner</li>
<li>corner2x &#038; corner2y : top right corner</li>
<li>corner3x &#038; corner3y : top left corner</li>
</ul>
<p>If you want to know what&#8217;s possible working with static textfields, have a look at this project: <a href="http://attractive-media.fr/flashpages/demo.html">flashpages</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bonth.nl/2011/05/05/textsnapshot-gettextruninfo-where-is-corner0x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SD kaart &#8220;kapot&#8221;, foto&#8217;s gered!</title>
		<link>http://www.bonth.nl/2010/08/03/sd-kaart-kapot-fotos-gered/</link>
		<comments>http://www.bonth.nl/2010/08/03/sd-kaart-kapot-fotos-gered/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 18:57:09 +0000</pubDate>
		<dc:creator>Arie</dc:creator>
				<category><![CDATA[dagelijks leven]]></category>

		<guid isPermaLink="false">http://www.bonth.nl/?p=355</guid>
		<description><![CDATA[Een paar weken geleden ging mijn Transcend 16 GB sdhc card ineens &#8220;kapot&#8221;. Tijdens het maken van foto&#8217;s met mijn Canon 450D gaf het fototoestel ineens een foutmelding en was de kaart niet meer bruikbaar. De kaart werd ook niet meer herkend als ik hem in een kaartlezer stopte. Ik heb het geprobeerd op zowel [...]]]></description>
			<content:encoded><![CDATA[<p>Een paar weken geleden ging mijn Transcend 16 GB sdhc card ineens &#8220;kapot&#8221;. Tijdens het maken van foto&#8217;s met mijn Canon 450D gaf het fototoestel ineens een foutmelding en was de kaart niet meer bruikbaar. De kaart werd ook niet meer herkend als ik hem in een kaartlezer stopte. Ik heb het geprobeerd op zowel OSX als Windows pc&#8217;s met interne en diverse externe cardreaders, maar er gebeurde helemaal niets als ik de kaart in de houder plaatste. Op de externe cardreader ging ook geen lampje branden, wat wel gebeurt bij andere, normaal werkende geheugen-kaarten. Omdat de kaart niet herkend werd kon ik ook geen recovery software proberen, zoals bv <a href="http://www.cgsecurity.org/wiki/PhotoRec">PhotoRec</a>.</p>
<p><span id="more-355"></span>Op de kaart stonden meer dan 500 foto&#8217;s die ik niet graag zou verliezen. Daarom ging ik op zoek naar een gespecialiseerd bedrijf wat me zou kunnen helpen. Ik heb het als eerste bij <a href="http://www.datarecovery.nl/">Yodata</a> geprobeerd, maar zij mailden het volgende: &#8220;Als de kaart zowel in het fototoestel als in diverse kaartreaders niet herkend wordt dan is die kans praktisch niet aanwezig. &#8230; Een kaart die moeizaam of gedeeltelijk nog herkend wordt kunnen we wel behandelen.&#8221;.<br />
Daar had ik dus niet veel aan: voor een softwarematige recovery heb ik geen gespecialiseerd bedrijf nodig.</p>
<p>Uiteindelijk ben ik naar tevredenheid geholpen door Recoverfab in Duitsland:<a href="http://card-recovery.biz/us/service.php"> http://card-recovery.biz/us/service.php</a>. De service is niet goedkoop (het kostte mij € 178,- voor 500 foto&#8217;s op een 16 GB sd-kaart), maar andere bedrijven die ik vond zijn nog vele malen duurder. En je hoeft pas te betalen nadat je een thumbnail van de gevonden foto&#8217;s hebt bekeken. No cure no pay dus. Je kan ook aangeven dat ze niet alle bestanden hoeven te recoveren, maar bv. alleen bestanden aangemaakt na een bepaalde datum of bestanden van een bepaald type. Ik wilde bv. alleen de raw-images van een bepaalde avond terug.</p>
<p>Afgelopen woensdag heb ik mijn sd-kaart naar Duitsland gestuurd. Vrijdag kreeg ik een ontvangsbevestiging en zaterdag kon ik alle gevonden raw-images al bekijken op een preview pagina. Het lijkt erop dat ze alle gemaakte foto&#8217;s van de kaart hebben kunnen halen en alleen de gevraagde bestanden hebben gerecovered. Al met al ben ik superblij, ik had niet verwacht mijn foto&#8217;s nog terug te zien.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bonth.nl/2010/08/03/sd-kaart-kapot-fotos-gered/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>AS3 Vector shuffle or randomize</title>
		<link>http://www.bonth.nl/2010/07/25/as3-vector-shuffle-or-randomize/</link>
		<comments>http://www.bonth.nl/2010/07/25/as3-vector-shuffle-or-randomize/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 20:56:11 +0000</pubDate>
		<dc:creator>Arie</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[actionscript vector array]]></category>

		<guid isPermaLink="false">http://www.bonth.nl/?p=325</guid>
		<description><![CDATA[Update: my Vector shuffle function will not work with Vector.&#60;int&#62;. Please read AS3 Object shuffle or randomize for an improved and more generic shuffleObject function. In almost all tools we develop for Gynzy and bord.nl the questions are randomized. When searching the net for a generic function to shuffle Actionscript Vectors, I couldn&#8217;t find any. That&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update</strong>: <em>my Vector shuffle function will not work with Vector.&lt;int&gt;. Please read <a title="AS3 Object shuffle or randomize" href="http://www.bonth.nl/2011/05/29/as3-object-shuffle-or-randomize/">AS3 Object shuffle or randomize</a> for an improved and more generic shuffleObject function.</em></p>
<p>In almost all tools we develop for <a href="http://www.gynzy.com">Gynzy</a> and <a href="http://www.bord.nl">bord.nl</a> the questions are randomized. When searching the net for a generic function to shuffle Actionscript Vectors, I couldn&#8217;t find any. That&#8217;s why I wrote this article and a shuffleVector function.</p>
<p><span id="more-325"></span>It all started with shuffling Arrays. My colleague <a href="http://www.gynzy.com/team/">Mathijs</a> showed me <a href="http://eli.thegreenplace.net/2010/05/28/the-intuition-behind-fisher-yates-shuffling/">this article</a> about Fisher-Yates shuffling: it&#8217;s efficient both in runtime and space and the result is really random.<br />
Mathijs translated the example Python code into Actionscript and I added some comments:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/**
 * Shuffles array with Fisher-Yates shuffling
 * using com.gskinner.utils.Rndm class
 * @param arr
 * example: ArrayUtils.shuffleArray(myArray);
 */</span>
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> shuffleArray<span style="color: #66cc66;">&#40;</span>arr:<span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>arr.<span style="color: #0066CC;">length</span> <span style="color: #66cc66;">&amp;</span>gt; <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = arr.<span style="color: #0066CC;">length</span> - <span style="color: #cc66cc;">1</span>;
		<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>i <span style="color: #66cc66;">&amp;</span>gt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> s:<span style="color: #0066CC;">Number</span> = Rndm.<span style="color: #006600;">integer</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, arr.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> temp:<span style="color: #66cc66;">*</span> = arr<span style="color: #66cc66;">&#91;</span>s<span style="color: #66cc66;">&#93;</span>;
			arr<span style="color: #66cc66;">&#91;</span>s<span style="color: #66cc66;">&#93;</span> = arr<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;
			arr<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = temp;
			i--;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>But what I really needed was a function to shuffle any kind of Vector. So I took the function above and changed it into this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/**
 * Shuffles Vector with Fisher-Yates shuffling
 * using com.gskinner.utils.Rndm class
 * @param vec
 * example: VectorUtils.shuffleVector(myVector as Vector.&amp;lt;*&amp;gt;);
 */</span>
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> shuffleVector<span style="color: #66cc66;">&#40;</span>vec:Vector.<span style="color: #66cc66;">&amp;</span>lt;<span style="color: #66cc66;">*&amp;</span>gt;<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>vec.<span style="color: #0066CC;">length</span> <span style="color: #66cc66;">&amp;</span>gt; <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = vec.<span style="color: #0066CC;">length</span> - <span style="color: #cc66cc;">1</span>;
		<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>i <span style="color: #66cc66;">&amp;</span>gt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> s:<span style="color: #0066CC;">Number</span> = Rndm.<span style="color: #006600;">integer</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, vec.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> temp:<span style="color: #66cc66;">*</span> = vec<span style="color: #66cc66;">&#91;</span>s<span style="color: #66cc66;">&#93;</span>;
			vec<span style="color: #66cc66;">&#91;</span>s<span style="color: #66cc66;">&#93;</span> = vec<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;
			vec<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = temp;
			i--;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>For me, it&#8217;s very convenient to have one function for shuffling all my Vectors. The only improvement I can think of is the &#8220;<code>as Vector.&lt;*&gt;</code>&#8221; part when calling the function: <code>VectorUtils.shuffleVector(myVector as Vector.&lt;*&gt;);</code><br />
If you have any suggestions to make this function call more elegant, please let me know.</p>
<p><strong>Note:</strong> <em>We use <a href="http://www.gskinner.com/blog/archives/2008/01/source_code_see.html">com.gskinner.utils.Rndm</a> class because it generates random numbers based on a seed number: necessary if you have to reproduce a random output.<br />
If you don&#8217;t have or want to use this class, change line 11<br />
<code>var s:Number = Rndm.integer(0, vec.length);</code><br />
into<br />
<del datetime="2011-01-12T13:41:43+00:00"><code>var s:Number = Math.round(Rndm.random()*(inVector.length-1));</code></del><br />
<code>var s:Number = Math.round(Math.random()*(vec.length));</code></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bonth.nl/2010/07/25/as3-vector-shuffle-or-randomize/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Vernieuwde Gynzy omgeving</title>
		<link>http://www.bonth.nl/2010/05/19/vernieuwde-gynzy-omgeving/</link>
		<comments>http://www.bonth.nl/2010/05/19/vernieuwde-gynzy-omgeving/#comments</comments>
		<pubDate>Wed, 19 May 2010 19:36:36 +0000</pubDate>
		<dc:creator>Arie</dc:creator>
				<category><![CDATA[flash projects]]></category>

		<guid isPermaLink="false">http://www.bonth.nl/?p=310</guid>
		<description><![CDATA[Afgelopen maandag was een belangrijke dag voor Gynzy! Ruim 2 maanden geleden hebben we op de IPON de eerste versie van onze oplossing geïntroduceerd. Maandag ging een volledig vernieuwde Gynzy live. Zo zijn er veel nieuwe tools bij gekomen, is het zoeken en vinden van tools eenvoudiger geworden en hebben we het bord nog makkelijker [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://bonth.files.wordpress.com/2010/05/bord_nl.png" alt="Gynzy" width="600" height="100" /></p>
<p>Afgelopen maandag was een belangrijke dag voor <a href="http://www.gynzy.nl">Gynzy</a>! Ruim 2 maanden geleden hebben we op de IPON de eerste versie van onze oplossing geïntroduceerd. Maandag ging <a href="http://bord.nl">een volledig vernieuwde Gynzy</a> live. Zo zijn er veel nieuwe tools bij gekomen, is het zoeken en vinden van tools eenvoudiger geworden en hebben we het bord nog makkelijker gemaakt.</p>
<p>Maar het grootste verschil met de vorige versie is dat de html-overzichts-website en de flash-presentatie-applicatie nu volledig zijn geïntegreerd. Je zoekt een nieuwe tool op de website (de tools-tab) en na selectie opent de tool automatisch in de bord-flash-site (de bord-tab). Op elk moment kan je eenvoudig switchen tussen html en flash zonder dat je het echt in de gaten hebt. Dat kan je goed zien op onderstaande screencast:</p>
<p><span id="more-310"></span>
<p><a href="http://www.youtube.com/watch?v=aPDPrpnqJ5c&#038;fmt=18">www.youtube.com/watch?v=aPDPrpnqJ5c</a></p>
<p>url: <a href="http://bord.nl">http://bord.nl</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bonth.nl/2010/05/19/vernieuwde-gynzy-omgeving/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Een zoon!</title>
		<link>http://www.bonth.nl/2010/04/19/een-zoon/</link>
		<comments>http://www.bonth.nl/2010/04/19/een-zoon/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 20:26:07 +0000</pubDate>
		<dc:creator>Arie</dc:creator>
				<category><![CDATA[dagelijks leven]]></category>

		<guid isPermaLink="false">http://www.bonth.nl/?p=285</guid>
		<description><![CDATA[Het is nu dik een week geleden dat onze zoon Huib op de wereld kwam. Het nieuws heeft al op twitter gestaan. De traditionele geboortekaartjes zijn al verstuurd. Het werd dus hoogste tijd om de zijn digitale geboortekaartje online te zetten: 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_geboortekaart_huib_1604754371"
			class="flashmovie"
			width="600"
			height="375">
	<param name="movie" value="http://www.bonth.nl/wordpress/wp-content/portfolio/2010-04-10-huib/geboortekaart_huib.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.bonth.nl/wordpress/wp-content/portfolio/2010-04-10-huib/geboortekaart_huib.swf"
			name="fm_geboortekaart_huib_1604754371"
			width="600"
			height="375">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bonth.nl/wordpress/wp-content/portfolio/2010-04-10-huib/huib.jpg" alt="Huib" width="600" height="150" /></p>
<p>Het is nu dik een week geleden dat onze zoon Huib op de wereld kwam.<br />
Het nieuws heeft al op <a href="http://twitter.com/redhotbeani/status/11934172355">twitter</a> gestaan.<br />
De traditionele geboortekaartjes zijn al verstuurd.<br />
Het werd dus hoogste tijd om de zijn digitale geboortekaartje online te zetten:</p>
<p><span id="more-285"></span>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_geboortekaart_huib_483763791"
			class="flashmovie"
			width="600"
			height="375">
	<param name="movie" value="http://www.bonth.nl/wordpress/wp-content/portfolio/2010-04-10-huib/geboortekaart_huib.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.bonth.nl/wordpress/wp-content/portfolio/2010-04-10-huib/geboortekaart_huib.swf"
			name="fm_geboortekaart_huib_483763791"
			width="600"
			height="375">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://www.bonth.nl/2010/04/19/een-zoon/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Gynzy&#8217;s IPON Launch</title>
		<link>http://www.bonth.nl/2010/03/24/gynzys-ipon-launch/</link>
		<comments>http://www.bonth.nl/2010/03/24/gynzys-ipon-launch/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 20:53:43 +0000</pubDate>
		<dc:creator>Arie</dc:creator>
				<category><![CDATA[dagelijks leven]]></category>
		<category><![CDATA[gynzy ipon]]></category>

		<guid isPermaLink="false">http://www.bonth.nl/?p=271</guid>
		<description><![CDATA[Woensdag 10 en donderdag 11 maart 2010 hebben we met het hele Gynzy team op IPON 2010 gestaan: een beurs over ICT in het onderwijs. Daar is de eerste bètaversie van onze digibord software gelanceerd. De beurs was een groot succes: we hebben veel geïnteresseerde bezoekers op onze stand gekregen en inmiddels is een groot [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://bonth.files.wordpress.com/2010/03/gynzy_ipon1.jpg" alt="Gynzy Ipon" width="600" height="150" /></p>
<p>Woensdag 10 en donderdag 11 maart 2010 hebben we met het hele <a href="http://www.gynzy.com/about.php">Gynzy team</a> op <a href="http://www.ipononline.nl/">IPON 2010</a> gestaan: een beurs over ICT in het onderwijs. Daar is de eerste bètaversie van onze <a href="http://bord.gynzy.com">digibord software</a> gelanceerd. De beurs was een groot succes: we hebben veel geïnteresseerde bezoekers op onze stand gekregen en inmiddels is een groot aantal leerkrachten ons product aan het testen.</p>
<p>Rutger heeft een leuke <a href="http://animoto.com/play/8TnYJhRVVk813BE0p1jT0Q">animoto video</a> gemaakt die een goede indruk geeft van de beurs: 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_vp1-7.0.21_1405498599"
			class="flashmovie"
			width="500"
			height="300">
	<param name="movie" value="http://static.animoto.com/swf/vp1-7.0.21.swf" />
	<param name="flashvars" value="duration=228017&amp;id=videoplayer&amp;file=8TnYJhRVVk813BE0p1jT0Q&amp;duration=228017&amp;created=1268868464" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://static.animoto.com/swf/vp1-7.0.21.swf"
			name="fm_vp1-7.0.21_1405498599"
			width="500"
			height="300">
		<param name="flashvars" value="duration=228017&amp;id=videoplayer&amp;file=8TnYJhRVVk813BE0p1jT0Q&amp;duration=228017&amp;created=1268868464" />
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://www.bonth.nl/2010/03/24/gynzys-ipon-launch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kinderen voor Kinderen wint Cinekid prijs</title>
		<link>http://www.bonth.nl/2009/10/26/kinderen-voor-kinderen-wint-cinekid-prijs/</link>
		<comments>http://www.bonth.nl/2009/10/26/kinderen-voor-kinderen-wint-cinekid-prijs/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 09:25:48 +0000</pubDate>
		<dc:creator>Arie</dc:creator>
				<category><![CDATA[flash projects]]></category>

		<guid isPermaLink="false">http://www.bonth.nl/?p=257</guid>
		<description><![CDATA[Kinderen voor Kinderen Online Karaoke wint Juryprijs Cinekid nieuwe media award. &#8220;Zojuist (22 oktober 2009) zijn de Cinekid Awards 2009 uitgereikt. In een overvolle zaal maakte Isolde Hallensleben de prijswinnaars van de Cinekidleeuwen (film), de Cinekid Kinderkasten (televisie) en de Cinekid Nieuwe Media Awards bekend. &#8230; maar de Cinekid Nieuwe Media Jury Award (€ 7.500) [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://bonth.wordpress.com/files/2009/10/cinekid_prijs_small.jpg" alt="Cinekid prijs" width="600" height="150" /></p>
<p><a href="http://kvk.karaoke.vara.nl/" target="_blank">Kinderen voor Kinderen Online Karaoke</a> wint Juryprijs <a href="http://www.cinekid.nl/nl/festival/nieuws/and-winners-are" target="_blank">Cinekid nieuwe media award</a>.</p>
<p><em>&#8220;Zojuist</em> (22 oktober 2009) <em>zijn de Cinekid Awards 2009 uitgereikt.  In een overvolle zaal maakte Isolde Hallensleben de prijswinnaars van de Cinekidleeuwen (film), de Cinekid Kinderkasten (televisie) en de Cinekid Nieuwe Media Awards bekend.<br />
&#8230; maar de Cinekid Nieuwe Media Jury Award (€ 7.500) ging naar Kinderen voor Kinderen Karaoke (website) van de VARA en Lost Boys.&#8221;</em></p>
<p>Geweldig, eindelijk een Flash project waaraan ik heb meegewerkt wat in de prijzen valt! Lees de volledige <a title="projectbeschrijving" href="http://lbi.lostboys.nl/werk/clients/vara/projects/kinderen-voor-kinderen-karaoke" target="_blank">projectbeschrijving</a> op lostboys.nl of <a href="http://www.bonth.nl/2008/10/11/kinderen-voor-kinderen-karaoke/" target="_blank">dit artikel over de karaoke website</a> op mijn weblog.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bonth.nl/2009/10/26/kinderen-voor-kinderen-wint-cinekid-prijs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Anne Frank: the making of</title>
		<link>http://www.bonth.nl/2009/10/11/anne-frank-video/</link>
		<comments>http://www.bonth.nl/2009/10/11/anne-frank-video/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 18:37:34 +0000</pubDate>
		<dc:creator>Arie</dc:creator>
				<category><![CDATA[flash projects]]></category>

		<guid isPermaLink="false">http://www.bonth.nl/?p=237</guid>
		<description><![CDATA[Het laatste project  waar ik bij Lost Boys aan gewerkt heb was het virtuele Anne Frank huis. Nu heeft de Anne Frank stichting op haar YouTube kanaal een &#8220;the making of&#8221; video gepost en kan ik eindelijk een impressie van dit mooie project laten zien. www.youtube.com/watch?v=caVZeqEcrg4 Ik heb maar een kleine bijdrage aan dit grote [...]]]></description>
			<content:encoded><![CDATA[<p>Het laatste project  waar ik bij Lost Boys aan gewerkt heb was het virtuele Anne Frank huis. Nu heeft de Anne Frank stichting op haar YouTube kanaal een &#8220;the making of&#8221; video gepost en kan ik eindelijk een impressie van dit mooie project laten zien.</p>
<p><a href="http://www.youtube.com/watch?v=caVZeqEcrg4">www.youtube.com/watch?v=caVZeqEcrg4</a></p>
<p>Ik heb maar een kleine bijdrage aan dit grote project geleverd. <a href="http://twitter.com/epologee" target="_blank">Eric-Paul Lecluse</a> en <a href="https://twitter.com/acidcats" target="_blank">Stephan Bezoen</a> hebben, met hulp van <a href="https://twitter.com/unitzeroone" target="_blank">Ralph Hauwert</a>, de basis gelegd voor de website. Daarnaast heeft <a href="http://www.m2media.biz/v3/html/#about">Antoine Lubach</a> eraan gewerkt en verzorgt <a href="http://twitter.com/jankeesvw" target="_blank">Jankees van Woezik</a> nu de laatste loodjes.</p>
<p>Met dank aan Jankees voor het posten van <a href="http://blog.base42.nl/2009/10/11/anne-frank/" target="_blank">dit artikel</a>.</p>
<p>url: <a href="http://www.youtube.com/annefrank">http://www.youtube.com/annefrank</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bonth.nl/2009/10/11/anne-frank-video/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

