<?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>blog.betabong.com</title>
	<atom:link href="http://blog.betabong.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.betabong.com</link>
	<description></description>
	<lastBuildDate>Thu, 02 Feb 2012 10:45:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Fluid Ratio Height</title>
		<link>http://blog.betabong.com/2012/02/02/fluid-ratio-height/</link>
		<comments>http://blog.betabong.com/2012/02/02/fluid-ratio-height/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 10:39:57 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=494</guid>
		<description><![CDATA[<p><a href="http://www.nirazul.ch/">Rouven</a>, a co-worker of mine, found a very neat CSS trick on how to create proportional container. Let&#8217;s say you want to embed a video in your fluid layout (content adjusts to page width). What you&#8217;d want is something like:&#8230; <a href="http://blog.betabong.com/2012/02/02/fluid-ratio-height/" class="read_more">Read more</a></p>
No related posts.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nirazul.ch/">Rouven</a>, a co-worker of mine, found a very neat CSS trick on how to create proportional container. Let&#8217;s say you want to embed a video in your fluid layout (content adjusts to page width). What you&#8217;d want is something like:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.video</span> <span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> 0.5625x<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Which means that your height should be 56.25% of your width (which is 100% by default with block elements). Why 56.25%? Because our video has the ratio of 16/9 and 9 divided by 16 is 0.5625.</p>
<p>Well, obviously, this won&#8217;t work, because CSS doesn&#8217;t provide a possibility to directly define height as a percentage of width. What Rouven found was a really nice work-around:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;style&gt;
   .video {
      position: relative;
   }
   .video &gt; .height {
      margin-top: 56.25%;
   }
   .video &gt; iframe {
      position: absolute;
      top: 0px; left: 0px;
      width: 100%; height: 100%;
   }
&lt;/style&gt;
&lt;div class=&quot;video&quot;&gt;
    &lt;div class=&quot;height&quot;&gt;&lt;/div&gt;
    &lt;iframe …&gt;&lt;/iframe&gt;
&lt;/div&gt;</pre></div></div>

<p>Why does this work? Because all percentage values of margin <a href="http://http://www.w3.org/TR/CSS2/box.html#margin-properties">relate to width</a>, even top and bottom. Surprised? I was!</p>
<p>What I don&#8217;t like about that solution is this semantically worthless div as a placeholder for the div. But guess what, there&#8217;s an even simpler solution: <a href="http://www.w3.org/TR/CSS2/box.html#padding-properties">padding percentages</a> work the exactly same way.</p>
<p>The final solution:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;style&gt;
   .video {
      position: relative;
      padding-top: 56.25%;
   }
   .video &gt; iframe {
      position: absolute;
      top: 0px; left: 0px;
      width: 100%; height: 100%;
   }
&lt;/style&gt;
&lt;div class=&quot;video&quot;&gt;
    &lt;iframe …&gt;&lt;/iframe&gt;
&lt;/div&gt;</pre></div></div>

<p><a class="download" href="/showcase/fluid-proportion.html">Demo</a></span></p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2012/02/02/fluid-ratio-height/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using CSSEdit with LESS</title>
		<link>http://blog.betabong.com/2011/05/15/using-cssedit-with-less/</link>
		<comments>http://blog.betabong.com/2011/05/15/using-cssedit-with-less/#comments</comments>
		<pubDate>Sun, 15 May 2011 13:56:00 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=351</guid>
		<description><![CDATA[<p><img src="http://blog.betabong.com/wp-content/uploads/2011/05/cssedit-less.jpg" alt="" title="cssedit-less" width="512" height="512" class="aligncenter size-full wp-image-347" /></p>
<p><a href="http://macrabbit.com/cssedit/">CSSEdit</a> is a great app I can&#8217;t live (or at least work) without. I&#8217;ve recently discovered the <a href="http://lesscss.org/">LESS</a> language, which basically extends CSS with some very very useful functionality &#8211; mainly variables and something like functions (called mixins).&#8230; <a href="http://blog.betabong.com/2011/05/15/using-cssedit-with-less/" class="read_more">Read more</a></p>
No related posts.]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.betabong.com/wp-content/uploads/2011/05/cssedit-less.jpg" alt="" title="cssedit-less" width="512" height="512" class="aligncenter size-full wp-image-347" /></p>
<p><a href="http://macrabbit.com/cssedit/">CSSEdit</a> is a great app I can&#8217;t live (or at least work) without. I&#8217;ve recently discovered the <a href="http://lesscss.org/">LESS</a> language, which basically extends CSS with some very very useful functionality &#8211; mainly variables and something like functions (called mixins). (By the way, things Google is gonna support natively in their Chrome browser soon – using a slightly different syntax though. See <a href="http://goo.gl/gTWLt">here</a>)</p>
<p>Although CSSEdit hasn&#8217;t been updated for much too long, it&#8217;s IMHO still the best CSS editor out there (I&#8217;ve tried quite a few), and as much as I appreciate the bonus of LESS, I wouldn&#8217;t wanna miss the comfort of CSSEdit.</p>
<p>My first approach to using LESS files with CSSEdit goes like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;link rel=&quot;stylesheet/less&quot; href=&quot;css/styles.css&quot;&gt;
&lt;script src=&quot;js/dev/less.min.js&quot;&gt;&lt;/script&gt;</pre></div></div>

<p>styles.css is actually a LESS file and just named with the extension .css so CSSEdit will force an update of its Live Preview every time you modify it.</p>
<p>This works well with smaller html/css combos, but gets more difficult with every complexity level. Reason why is that the whole page will be refreshed with every change.</p>
<p>(I&#8217;ve tried to actually get around this by messing with the source less.js. Although I&#8217;ve nailed the refresh triggering down to the xhr.send() the actual reason stayed mysterious to my brain cells. May be if I&#8217;d knew the exact mechanism of how the CSSEdit Live Preview update works&#8230; but then, just read on:) </p>
<p><strong>There is though a fantastic solution.</strong> One that&#8217;s also of big help if you work with other editors by the way. LESS has a very nice watch option. Whenever a linked LESS file gets updated, the resulting CSS will be generated and replaced. The great thing if you work with CSSEdit is that you won&#8217;t have to save your file to see any changes. From a CSS designer (or developer) point of view the outcome is a near-instant live preview. (LESS actually checks for changes in a Timer interval of 1000ms).</p>
<p>That&#8217;s how this looks in code:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;link rel=&quot;stylesheet/less&quot; href=&quot;css/styles.less&quot;&gt;
&lt;script src=&quot;js/dev/less.min.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;less.watch();&lt;/script&gt;</pre></div></div>

<p>If you like to sometimes see a live preview and sometimes just css the hell out of you without any disturbances until the next save, you can also use the glorious Hash Override: just leave away the &#8220;less.watch()&#8221; part in your script and open your html in the live preview with an additional &#8220;#!watch&#8221; hash. Something like this:</p>
<p><img src="http://blog.betabong.com/wp-content/uploads/2011/05/Screen-shot-2011-05-15-at-15.29.33.png" alt="" title="Screen shot 2011-05-15 at 15.29.33" width="330" height="26" class="aligncenter size-full wp-image-345" /></p>
<p>Wow, this will easen my life (ehm.. work) so much! Seriously, I really started to hate those page reloads.</p>
<p>Oh, and by the way, just in case I haven&#8217;t noted so far: I&#8217;d really love to see a CSSEdit update anytime soon. I&#8217;m so much willing to drink my self made <a href="http://www.kochbuchfotos.de/14/espresso">Espresso</a> for that. ;-) In case the <a href="http://macrabbit.com/">Rabbit</a> listens.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2011/05/15/using-cssedit-with-less/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>jQuery Plugin: Round Text</title>
		<link>http://blog.betabong.com/2010/05/13/jquery-plugin-round-text/</link>
		<comments>http://blog.betabong.com/2010/05/13/jquery-plugin-round-text/#comments</comments>
		<pubDate>Thu, 13 May 2010 09:49:40 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[rotate]]></category>
		<category><![CDATA[transform]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=326</guid>
		<description><![CDATA[<p>My very first jQuery plugin: warps the text along a circle. It&#8217;s simple and certainly far from perfect – I needed it, so may be you&#8217;ll need it too :-)</p>
<h3>Usage:</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>elem<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">roundtext</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#123;</span>radius<span style="color: #339933;">:</span><span style="color: #CC0000;">150</span><span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Tested&#8230; <a href="http://blog.betabong.com/2010/05/13/jquery-plugin-round-text/" class="read_more">Read more</a></p>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>My very first jQuery plugin: warps the text along a circle. It&#8217;s simple and certainly far from perfect – I needed it, so may be you&#8217;ll need it too :-)</p>
<h3>Usage:</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>elem<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">roundtext</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#123;</span>radius<span style="color: #339933;">:</span><span style="color: #CC0000;">150</span><span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Tested on latest Opera, Safari, Chrome and Firefox (I assume it won&#8217;t work in bloody IE)</p>
<h3>Download:</h3>
<p><a class="download" href="/showcase/jquery-roundtext/jquery.roundtext.js">jquery.roundtext.js</a></p>
<h3>Example:</h3>
<p><iframe src="/showcase/jquery-roundtext/jquery.roundtext.html" width="100%" height="550" frameborder="0"></iframe></p>
<p>I used this function here: <a href="http://www.retro-fanshirt.com">www.retro-fanshirt.com</a> (Turn off plugins to see html version)</p>
<p>Sometimes I can see strange behaviour with Safari when it wouldn&#8217;t consider space characters. Just so you know.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2010/05/13/jquery-plugin-round-text/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>links for 2010-04-01</title>
		<link>http://blog.betabong.com/2010/04/02/links-for-2010-04-01/</link>
		<comments>http://blog.betabong.com/2010/04/02/links-for-2010-04-01/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 01:34:10 +0000</pubDate>
		<dc:creator>delicious</dc:creator>
				<category><![CDATA[]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/2010/04/02/links-for-2010-04-01/</guid>
		<description><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://www.thejohnnycashproject.com/#/explore/TopRated">THE JOHNNY CASH PROJECT</a></div>
<div class="delicious-extended">Fantastic idea, fantastic implementation!</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/flash">flash</a> <a href="http://delicious.com/sok/drawing">drawing</a> <a href="http://delicious.com/sok/painting">painting</a> <a href="http://delicious.com/sok/inspiration">inspiration</a> <a href="http://delicious.com/sok/movie">movie</a> <a href="http://delicious.com/sok/community">community</a> <a href="http://delicious.com/sok/collaboration">collaboration</a>)</div>
</li>
</ul>
<p>No related posts.</p>
No related posts.]]></description>
			<content:encoded><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://www.thejohnnycashproject.com/#/explore/TopRated">THE JOHNNY CASH PROJECT</a></div>
<div class="delicious-extended">Fantastic idea, fantastic implementation!</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/flash">flash</a> <a href="http://delicious.com/sok/drawing">drawing</a> <a href="http://delicious.com/sok/painting">painting</a> <a href="http://delicious.com/sok/inspiration">inspiration</a> <a href="http://delicious.com/sok/movie">movie</a> <a href="http://delicious.com/sok/community">community</a> <a href="http://delicious.com/sok/collaboration">collaboration</a>)</div>
</li>
</ul>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2010/04/02/links-for-2010-04-01/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use GZip compression for your website</title>
		<link>http://blog.betabong.com/2010/03/25/use-gzip-compression-for-html-css-javascript-xml/</link>
		<comments>http://blog.betabong.com/2010/03/25/use-gzip-compression-for-html-css-javascript-xml/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 09:53:50 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Frontend]]></category>
		<category><![CDATA[Browser]]></category>
		<category><![CDATA[Compression]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=316</guid>
		<description><![CDATA[<p>Most of my Flash apps or websites use XML files, either for communication or initial data. They can get quite large, reaching about 100 kb or more is not seldom. You might say: so what?! 100 kb is like nothing&#8230; <a href="http://blog.betabong.com/2010/03/25/use-gzip-compression-for-html-css-javascript-xml/" class="read_more">Read more</a></p>
Related posts:<ol>
<li><a href='http://blog.betabong.com/2009/03/05/javascript-canvas-3d/' rel='bookmark' title='3D Point Cloud with Javascript and Canvas'>3D Point Cloud with Javascript and Canvas</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Most of my Flash apps or websites use XML files, either for communication or initial data. They can get quite large, reaching about 100 kb or more is not seldom. You might say: so what?! 100 kb is like nothing for a bandwidth nowadays! Well, if you&#8217;ve every used iPhone tethering in an area where there is no 3g network, you start appreciating every single byte you won&#8217;t have to suck from the net. (On a side note: That&#8217;s when Opera really comes in handy.)</p>
<h3>XML files compress really well</h3>
<p>Because XML usually contains a lot of repetitive elements (noticably tags and attributes), they are like a compressor&#8217;s darling. Just zip a few of your XML files and you&#8217;ll see.</p>
<p>Now I kind of always thought that on nowadays webservers gzip compression is activated by default anyway. Which was wrong, at least for quite a bunch of servers I use.</p>
<h3>Activate GZip compression</h3>
<p>If your server installation contains the deflate module (which is the case for all of the ones I use), then you can simply add the following line to your .htaccess file:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># compress all html, plain text, xml, css and javascript:
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript</pre></div></div>

<p>AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript</p>
<div>I&#8217;ve also tried more complex constructs found on the web, but they resulted in «Internal server errors» which is why I&#8217;ll go along with this simple one for now.</div>
<div><strong><span style="font-weight: normal;">The effects are dramatic! I usually get about 70% – 80% of reduction for non-minimized files, </span></strong></div>
<div>
<h3>Examples</h3>
</div>
<div>
<table border="0" class="small">
<tbody>
<tr>
<th></th>
<th>Uncompressed</th>
<th>Compressed</th>
<th>Reduction</th>
</tr>
<tr>
<td><strong>Javascript minimized</strong><br />
<a href="http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js">MooTools YUI compressed</a></td>
<td>66,867</td>
<td>20,964</td>
<td>68.6%</td>
</tr>
<tr>
<td><strong>Javascript minimized</strong><br />
<a href="http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools.jss">MooTools uncompressed</a></td>
<td>102,991</td>
<td>27,599</td>
<td>73.2%</td>
</tr>
<tr>
<td><strong>XML/CSS combined</strong><br />
<a href="http://www.ceylor.ch/pages/home.xml">A larger initial XML file for a Flash website of mine</a></td>
<td>84,316</td>
<td>18,229</td>
<td>78.4%</td>
</tr>
<tr>
<td><strong>XML/CSS combined</strong><br />
<a href="http://www.ceylor.ch/pages/home.xml">A larger initial XML file for a Flash website of mine</a></td>
<td>84,316</td>
<td>18,229</td>
<td>78.4%</td>
</tr>
<tr>
<td><strong>HTML</strong><br />
<a href="http://20min.ch">A swiss news website, 20 Minuten</a></td>
<td>148,587</td>
<td>29,385</td>
<td>80.2%</td>
</tr>
<tr>
<td><strong>HTML</strong><br />
<a href="http://blog.betabong.com">My blogs home page</a></td>
<td>51,638</td>
<td>12,991</td>
<td>74.8%</td>
</tr>
</tbody>
</table>
<h3>Tools</h3>
<p>If you want to test your website, these pages are very informative (first one is faster, second one more informative):</p>
<p><a href="http://www.whatsmyip.org/http_compression/">http://www.whatsmyip.org/http_compression/</a></div>
<p><a href="http://www.gidnetwork.com/tools/gzip-test.php">http://www.gidnetwork.com/tools/gzip-test.php</a></p>
<p>I also like this one, although it only gives you little info on content-encoding. But very much on top of that :-)<br />
<a href="http://www.wmtips.com/tools/info/">http://www.wmtips.com/tools/info/</a></p>
<p>This little Firefox addon will tell you wether any site you visit has GZip activated:<br />
<a href="https://addons.mozilla.org/en-US/firefox/addon/54647">https://addons.mozilla.org/en-US/firefox/addon/54647</a> (Content Encoding Detector)</p>
<h3 style="font-size: 1.17em;">Conclusion</h3>
<p>HTML websites will profit a lot from this compression, as well as Flash sites (if just for your swfobject.js) that use textual communication. And best of all: it won&#8217;t need any kungfu effort on your side! And: practically all browsers support it. (I&#8217;ve only heard of problems with IE6, but then, you know, f*** IE6)</p>
<h3>Update:</h3>
<p>A more complete solution for your .htaccess file:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&lt;IfModule mod_deflate.c&gt;
	AddOutputFilterByType DEFLATE text/html
	AddOutputFilterByType DEFLATE text/xml
&nbsp;
	AddOutputFilterByType DEFLATE image/x-icon
&nbsp;
	AddOutputFilterByType DEFLATE text/css
&nbsp;
	AddOutputFilterByType DEFLATE text/javascript
	AddOutputFilterByType DEFLATE application/javascript
	AddOutputFilterByType DEFLATE application/x-javascript
	AddOutputFilterByType DEFLATE text/x-js
	AddOutputFilterByType DEFLATE text/ecmascript
	AddOutputFilterByType DEFLATE application/ecmascript
	AddOutputFilterByType DEFLATE text/vbscript
	AddOutputFilterByType DEFLATE text/fluffscript
&nbsp;
	AddOutputFilterByType DEFLATE image/svg+xml
	AddOutputFilterByType DEFLATE application/x-font-ttf
	AddOutputFilterByType DEFLATE application/x-font
	AddOutputFilterByType DEFLATE font/opentype
	AddOutputFilterByType DEFLATE font/otf
	AddOutputFilterByType DEFLATE font/ttf
	AddOutputFilterByType DEFLATE application/x-font-truetype
	AddOutputFilterByType DEFLATE application/x-font-opentype
	AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
	AddOutputFilterByType DEFLATE application/vnd.oasis.opendocument.formula-template
&lt;/IfModule&gt;</pre></div></div>

<p>(<a href="http://www.speedingupwebsite.com/2010/01/08/use-the-gzip-power/">Source</a>)</p>
<p>Related posts:<ol>
<li><a href='http://blog.betabong.com/2009/03/05/javascript-canvas-3d/' rel='bookmark' title='3D Point Cloud with Javascript and Canvas'>3D Point Cloud with Javascript and Canvas</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2010/03/25/use-gzip-compression-for-html-css-javascript-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>links for 2010-03-22</title>
		<link>http://blog.betabong.com/2010/03/23/links-for-2010-03-22/</link>
		<comments>http://blog.betabong.com/2010/03/23/links-for-2010-03-22/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 01:35:57 +0000</pubDate>
		<dc:creator>delicious</dc:creator>
				<category><![CDATA[]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/2010/03/23/links-for-2010-03-22/</guid>
		<description><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://www.insideria.com/2010/01/intellij-idea-9-for-flash-dev.html">IntelliJ Idea 9 For Flash</a></div>
<div class="delicious-extended">A developers first impression. I really like IntelliJ.</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/flash">flash</a> <a href="http://delicious.com/sok/development">development</a> <a href="http://delicious.com/sok/actionscript">actionscript</a> <a href="http://delicious.com/sok/adobe">adobe</a> <a href="http://delicious.com/sok/intellij">intellij</a>)</div>
</li>
</ul>
<p>No related posts.</p>
No related posts.]]></description>
			<content:encoded><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://www.insideria.com/2010/01/intellij-idea-9-for-flash-dev.html">IntelliJ Idea 9 For Flash</a></div>
<div class="delicious-extended">A developers first impression. I really like IntelliJ.</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/flash">flash</a> <a href="http://delicious.com/sok/development">development</a> <a href="http://delicious.com/sok/actionscript">actionscript</a> <a href="http://delicious.com/sok/adobe">adobe</a> <a href="http://delicious.com/sok/intellij">intellij</a>)</div>
</li>
</ul>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2010/03/23/links-for-2010-03-22/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to watch TV from abroad</title>
		<link>http://blog.betabong.com/2009/11/30/how-to-watch-tv-from-abroad/</link>
		<comments>http://blog.betabong.com/2009/11/30/how-to-watch-tv-from-abroad/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 15:12:17 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[tv]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=304</guid>
		<description><![CDATA[<p>From time to time I spend a few weeks abroad. From time to time I&#8217;d like to watch swiss tv while I&#8217;m there. There are services like Zattoo or Wilmaa out there, that allow you to watch tv via internet,&#8230; <a href="http://blog.betabong.com/2009/11/30/how-to-watch-tv-from-abroad/" class="read_more">Read more</a></p>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>From time to time I spend a few weeks abroad. From time to time I&#8217;d like to watch swiss tv while I&#8217;m there. There are services like Zattoo or Wilmaa out there, that allow you to watch tv via internet, but they only allow IPs from within your home country, in my case Switzerland.</p>
<p>So we want them to believe that we&#8217;re home, not 4000 miles away on some sunny island (dream on). The solution is kind of simple actually, once you know how to do it, but it took me far too long to find it out anyway – so I thought it might be worth sharing (which also prevents me forgetting it).</p>
<p>We just need to route all relevant internet traffice through a home computer. You need to have SSH access to this computer, and you need to have a decent internet upload speed for video stuff. Lucky me I have a loyal and faithful Mac Mini at home, acting as Media Center, SVN server and .. well, as a decent TV proxy :-) Here&#8217;s how you do:</p>
<ol>
<li>Open Terminal, enter:<br />
<strong>ssh -2 -C -D 2001 </strong><em><strong>username</strong></em><strong>@</strong><em><strong>yourserver.com</strong></em><br />
(<em>username</em> is your account on the remote machine – and <em>yourserver.com</em> could be an ip or whatever address your server has. I use <a href="http://www.dyndns.com/">Dynamic DNS</a> for mine.)</li>
<li>Enter the password for <em>username</em></li>
<li>Open «<strong>System Preferences</strong>» and go to «<strong>Network</strong>» (You can close the Terminal). Click the Button «<strong>Advanced&#8230;</strong>»<br />
<a href="http://blog.betabong.com/wp-content/uploads/2009/11/Screen-shot-2009-11-30-at-15.41.17.png" rel="lightbox[304]"><img class="size-medium wp-image-305" title="Screen shot 2009-11-30 at 15.41.17" src="http://blog.betabong.com/wp-content/uploads/2009/11/Screen-shot-2009-11-30-at-15.41.17-300x234.png" alt="Screen shot 2009-11-30 at 15.41.17" width="300" height="234" /></a></li>
<li style="clear: both">Go to «<strong>Proxies</strong>» and activate SOCKS Proxy and enter<br />
Socks Proxy Server: <strong>127.0.0.1</strong> : <strong>2001</strong> (see picture)</li>
<li>Go to <a href="http://whatismyipaddress.com/">What Is My IP Address?</a> or this <a href="http://www.ip-adress.com/ip_tracer/">IP Tracer</a> to check if everything works. If the map shows you&#8217;re at home, you&#8217;re good to go!</li>
</ol>
<p>Now for TV I recommand <a href="http://www.wilmaa.com/">Wilmaa</a>: worked perfectly for me. Surprisingly good quality, and it&#8217;s for free! Great for football matches or Heidi in swiss german ;-)</p>
<p><a href="http://blog.betabong.com/wp-content/uploads/2009/11/Screen-shot-2009-11-30-at-Mo.-30.11-16.24.56.png" rel="lightbox[304]"><img class="alignnone size-large wp-image-313" title="Screen shot 2009-11-30 at Mo. 30.11  16.24.56" src="http://blog.betabong.com/wp-content/uploads/2009/11/Screen-shot-2009-11-30-at-Mo.-30.11-16.24.56-520x325.png" alt="Screen shot 2009-11-30 at Mo. 30.11  16.24.56" width="512" height="320" /></a></p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/11/30/how-to-watch-tv-from-abroad/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>links for 2009-11-18</title>
		<link>http://blog.betabong.com/2009/11/19/links-for-2009-11-18/</link>
		<comments>http://blog.betabong.com/2009/11/19/links-for-2009-11-18/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 01:34:15 +0000</pubDate>
		<dc:creator>delicious</dc:creator>
				<category><![CDATA[]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/2009/11/19/links-for-2009-11-18/</guid>
		<description><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://www.huntstudio.com.au/">Hunt. &#124; Multi-disciplinary design studio &#124; Melbourne</a></div>
<div class="delicious-extended">Some nice simplistic branding stuff.</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/inspiration">inspiration</a> <a href="http://delicious.com/sok/design">design</a> <a href="http://delicious.com/sok/identity">identity</a> <a href="http://delicious.com/sok/branding">branding</a> <a href="http://delicious.com/sok/print">print</a> <a href="http://delicious.com/sok/web">web</a> <a href="http://delicious.com/sok/portfolio">portfolio</a>)</div>
</li>
</ul>
<p>No related posts.</p>
No related posts.]]></description>
			<content:encoded><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://www.huntstudio.com.au/">Hunt. | Multi-disciplinary design studio | Melbourne</a></div>
<div class="delicious-extended">Some nice simplistic branding stuff.</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/inspiration">inspiration</a> <a href="http://delicious.com/sok/design">design</a> <a href="http://delicious.com/sok/identity">identity</a> <a href="http://delicious.com/sok/branding">branding</a> <a href="http://delicious.com/sok/print">print</a> <a href="http://delicious.com/sok/web">web</a> <a href="http://delicious.com/sok/portfolio">portfolio</a>)</div>
</li>
</ul>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/11/19/links-for-2009-11-18/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Binary Fun &#8211; Bits in Bed with Actionscript</title>
		<link>http://blog.betabong.com/2009/09/22/binary-fun-bits-in-bed-with-actionscript/</link>
		<comments>http://blog.betabong.com/2009/09/22/binary-fun-bits-in-bed-with-actionscript/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 23:19:40 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[Utility]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=297</guid>
		<description><![CDATA[<p><img src="http://blog.betabong.com/wp-content/uploads/2009/09/betabits.png" alt="betabits" title="betabits" width="503" height="191" class="alignright size-full wp-image-299" /></p>
<p>I went down a few algorithmic roads recently, digging into path finding and – for some obscure reasons – bit manipulations. Or byte. Whatever.</p>
<p>Along this way some utility methods (or functions) were born, and I thought: May be&#8230; <a href="http://blog.betabong.com/2009/09/22/binary-fun-bits-in-bed-with-actionscript/" class="read_more">Read more</a></p>
Related posts:<ol>
<li><a href='http://blog.betabong.com/2008/09/01/speed-parsing-string-in-as3/' rel='bookmark' title='Simplicity follows Performance – parsing Strings in Actionscript 3'>Simplicity follows Performance – parsing Strings in Actionscript 3</a></li>
<li><a href='http://blog.betabong.com/2009/04/13/metatunnel-1k-demo-as-vs-js/' rel='bookmark' title='Metatunnel 1k Demo: AS vs. JS'>Metatunnel 1k Demo: AS vs. JS</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.betabong.com/wp-content/uploads/2009/09/betabits.png" alt="betabits" title="betabits" width="503" height="191" class="alignright size-full wp-image-299" /></p>
<p>I went down a few algorithmic roads recently, digging into path finding and – for some obscure reasons – bit manipulations. Or byte. Whatever.</p>
<p>Along this way some utility methods (or functions) were born, and I thought: May be some day some of them may be in use to any of you ;)</p>
<p>For my dear non-geeky readers: A bit is the smallest part in software. It&#8217;s either this or that, either 0 or 1, either false or true. With a group of 2 bits you already have 4 states: 00, 01, 10 and 11. With 8 it&#8217;s 256 and so on (2^n).</p>
<p>As it would be too boring to just type 0 or 1, and because we have more than 2 fingers, man invented numbers to accumulate these bits: so 9 stands for 1001, and because 9 is shorter than 1001, we prefer 9. Some even write AB for 10101011, but that&#8217;s where we come back to geeky world.</p>
<p>So after this highly informative introduction, let&#8217;s get to some code. First, let&#8217;s count bits:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">static</span> <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> countBits<span style="color: #66cc66;">&#40;</span> value : uint <span style="color: #66cc66;">&#41;</span> : uint <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> count:uint = <span style="color: #cc66cc;">0</span>;
	<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>value<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> value <span style="color: #66cc66;">&amp;</span> <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			count++;
		<span style="color: #66cc66;">&#125;</span>
		value <span style="color: #66cc66;">&gt;&gt;&gt;</span>= <span style="color: #cc66cc;">1</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">return</span> count;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Example:<br />
countBits( 0xAB ) -> 5</p>
<p>Now sometimes you might wanna know: Does this data contain no more than 1 bit? We could just ask countBits( value ) == 1. But that&#8217;s not as speedy as it should be, right? So here we go:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">static</span> <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> is_1_bit<span style="color: #66cc66;">&#40;</span> value : uint <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Boolean</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> count:uint = <span style="color: #cc66cc;">0</span>;
	<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>value<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> value <span style="color: #66cc66;">&amp;</span> <span style="color: #cc66cc;">1</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>count == <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
			count++;
		<span style="color: #66cc66;">&#125;</span>
		value <span style="color: #66cc66;">&gt;&gt;&gt;</span>= <span style="color: #cc66cc;">1</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">return</span> count == <span style="color: #cc66cc;">1</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Examples:<br />
is_1_bit( 0xAB ) -> false<br />
is_1_bit( 0&#215;400 ) -> true</p>
<p>uint are by the way 32bit data, so a maximum of 32 of these bits we&#8217;re talking about can be turned on or off. That&#8217;s a lot of data. 4&#8217;294&#8217;967&#8217;296 combinations (though not that high compared to the numbers we read every day in the newspapers recently). Anyway, sometimes we might wanna access and set only a group of bits (usually 4 or 8) within this quite large row of bits:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">static</span> <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getBitGroup<span style="color: #66cc66;">&#40;</span> value : uint , group : uint , len : uint = <span style="color: #cc66cc;">4</span> <span style="color: #66cc66;">&#41;</span> : uint <span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span> value <span style="color: #66cc66;">&gt;&gt;</span> <span style="color: #66cc66;">&#40;</span>group<span style="color: #66cc66;">*</span>len<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">%</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&lt;&lt;</span> len<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">static</span> <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setBitGroup<span style="color: #66cc66;">&#40;</span> value : uint , groupValue :uint , group : uint , len : uint = <span style="color: #cc66cc;">4</span> <span style="color: #66cc66;">&#41;</span> : uint <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> pos:uint = group <span style="color: #66cc66;">*</span> len;
	<span style="color: #000000; font-weight: bold;">var</span> mask:uint = n_bits<span style="color: #66cc66;">&#40;</span>pos<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> right_bits:uint = value <span style="color: #66cc66;">&amp;</span> mask;
	value <span style="color: #66cc66;">&gt;&gt;&gt;</span>= pos + len;
	value <span style="color: #66cc66;">&lt;&lt;</span>= len;
	value <span style="color: #66cc66;">|</span>= groupValue;
	value <span style="color: #66cc66;">&lt;&lt;</span>= pos;
	value <span style="color: #66cc66;">|</span>= right_bits;
	<span style="color: #b1b100;">return</span> value;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Don&#8217;t they look just groovy?! Yeah baby!</p>
<p>Anyway, that&#8217;s all for now. Stay tuned for some crazy path finding. If I find time (sometimes I wonder how all those bloggers find their time to write so much..) Not to mention Twitter. Boohaa.</p>
<p>Related posts:<ol>
<li><a href='http://blog.betabong.com/2008/09/01/speed-parsing-string-in-as3/' rel='bookmark' title='Simplicity follows Performance – parsing Strings in Actionscript 3'>Simplicity follows Performance – parsing Strings in Actionscript 3</a></li>
<li><a href='http://blog.betabong.com/2009/04/13/metatunnel-1k-demo-as-vs-js/' rel='bookmark' title='Metatunnel 1k Demo: AS vs. JS'>Metatunnel 1k Demo: AS vs. JS</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/09/22/binary-fun-bits-in-bed-with-actionscript/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Garbage Collection, Dictionaries and Listeners</title>
		<link>http://blog.betabong.com/2009/09/09/garbage-collection-dictionary-listener/</link>
		<comments>http://blog.betabong.com/2009/09/09/garbage-collection-dictionary-listener/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 17:06:03 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=286</guid>
		<description><![CDATA[<p><a href="http://blog.betabong.com/wp-content/uploads/2009/09/031609_garbage_can.jpg" rel="lightbox[286]"><img src="http://blog.betabong.com/wp-content/uploads/2009/09/031609_garbage_can-211x300.jpg" alt="031609_garbage_can" title="031609_garbage_can" width="211" height="300" class="alignright size-medium wp-image-290" style="float:right; margin-left: 10px;" /></a>As we all know Flash&#8217;s garbage collector is a hell of a beast. It tries to free memory from &#8220;unused&#8221; objects (aka objects not somehow cross-referenced by the root). <strong>So from time to time our garbage collector checks for those</strong>&#8230; <a href="http://blog.betabong.com/2009/09/09/garbage-collection-dictionary-listener/" class="read_more">Read more</a></p>
No related posts.]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.betabong.com/wp-content/uploads/2009/09/031609_garbage_can.jpg" rel="lightbox[286]"><img src="http://blog.betabong.com/wp-content/uploads/2009/09/031609_garbage_can-211x300.jpg" alt="031609_garbage_can" title="031609_garbage_can" width="211" height="300" class="alignright size-medium wp-image-290" style="float:right; margin-left: 10px;" /></a>As we all know Flash&#8217;s garbage collector is a hell of a beast. It tries to free memory from &#8220;unused&#8221; objects (aka objects not somehow cross-referenced by the root). <strong>So from time to time our garbage collector checks for those objects and kicks them out of memory.. at least some of them.</strong></p>
<p>There are lots of articles written about the garbage collector and I&#8217;m not going into it any deeper. Let&#8217;s just summarize that no developer likes that kind of behaviour &#8212; it&#8217;s totally <strong>unpredictable</strong>. System.gc() would help a little, but it&#8217;s only available to debug players.</p>
<p>You may say: what do you care about memory handling! And I&#8217;d answer: not that much actually! :-) But what I really care about is false behaviour that can result.</p>
<p>Within Flash we have two ways to keep weak references to objects: Dictionary and weak listeners (weak method closures). We use weak references so that objects will be collected by the garbage collector. Now when it comes to Dictionaries, they behave as I&#8217;d expect. A &#8220;dead&#8221; object won&#8217;t be listed in a for each loop. But events events events&#8230;. <strong>they&#8217;ll be dispatched to each and every &#8220;dead&#8221; object residing in memory!! Which is such a pain in the ass really!</strong></p>
<p>After a lot of testing I can give only the advice you&#8217;ve probably heard many times before:</p>
<p><strong>Always remove listeners! Even the weak ones!</strong></p>
<p>Otherwise you have to potentially deal with unexpected behaviour. I may gonna create some utility class for that that deals with this problem.</p>
<p><span id="more-286"></span></p>
<p>Here my testing code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">TimerEvent</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">system</span>.<span style="color: #0066CC;">System</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #006600;">TextFieldAutoSize</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextFormat</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">Dictionary</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">Timer</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> net.<span style="color: #006600;">hires</span>.<span style="color: #006600;">debug</span>.<span style="color: #006600;">Stats</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MemoryLeakTest <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> counter : uint;
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> dict:Dictionary = <span style="color: #000000; font-weight: bold;">new</span> Dictionary<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> t:<span style="color: #0066CC;">TextField</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> makeGC:<span style="color: #0066CC;">Boolean</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> switcher:uint;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MemoryLeakTest<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			t = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			t.<span style="color: #006600;">defaultTextFormat</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextFormat</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #cc66cc;">18</span> , 0x999999 , <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
			t.<span style="color: #0066CC;">autoSize</span> = TextFieldAutoSize.<span style="color: #0066CC;">LEFT</span>;
			addChild<span style="color: #66cc66;">&#40;</span>t<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> timer : Timer = <span style="color: #000000; font-weight: bold;">new</span> Timer<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">100</span> <span style="color: #66cc66;">&#41;</span>;
			timer.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>TimerEvent.<span style="color: #006600;">TIMER</span>,handleTimer<span style="color: #66cc66;">&#41;</span>;
			timer.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #0066CC;">stage</span>.<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>;
&nbsp;
&nbsp;
			<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> Stats<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> handleTimer<span style="color: #66cc66;">&#40;</span> event : TimerEvent <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			counter = <span style="color: #cc66cc;">0</span>;
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> makeGC <span style="color: #66cc66;">&#41;</span> <span style="color: #0066CC;">System</span>.<span style="color: #006600;">gc</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			dispatchEvent<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">CHANGE</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> i:uint;
			<span style="color: #b1b100;">for</span> <span style="color: #b1b100;">each</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">var</span> obj:<span style="color: #66cc66;">*</span> <span style="color: #b1b100;">in</span> dict <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				i++;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			t.<span style="color: #0066CC;">text</span> = <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;Still &quot;</span> + counter + <span style="color: #ff0000;">&quot; dead objects living... (GC &quot;</span> + <span style="color: #66cc66;">&#40;</span>makeGC?<span style="color: #ff0000;">'on'</span>:<span style="color: #ff0000;">'off'</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">')'</span> <span style="color: #66cc66;">&#41;</span>;
			t.<span style="color: #006600;">appendText</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>In dictionary: '</span> + i <span style="color: #66cc66;">&#41;</span>;
			t.<span style="color: #006600;">appendText</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>Click to switch manual Garbage Collection aka System.gc()'</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> switcher++ <span style="color: #66cc66;">%</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">new</span> TestSprite<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">this</span> <span style="color: #66cc66;">&#41;</span>;
				t.<span style="color: #006600;">appendText</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>Added new test object (should live for 10 msec)'</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> handleClick<span style="color: #66cc66;">&#40;</span> event : Event <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			makeGC = <span style="color: #66cc66;">!</span>makeGC;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>	
<span style="color: #66cc66;">&#125;</span>
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">InteractiveObject</span>;
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">Timer</span>;
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">TimerEvent</span>;
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">system</span>.<span style="color: #0066CC;">System</span>;
&nbsp;
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> TestSprite <span style="color: #0066CC;">extends</span> Sprite <span style="color: #66cc66;">&#123;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">// the TestSprite instance should not live longer than 10 msec</span>
&nbsp;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> TestSprite<span style="color: #66cc66;">&#40;</span> parent : Sprite <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #808080; font-style: italic;">// add to weak dictionary</span>
		<span style="color: #808080; font-style: italic;">//MemoryLeakTest.dict[ this ] = true;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">// temporarily add to parent</span>
		parent.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">this</span> <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #000000; font-weight: bold;">var</span> timer : Timer = <span style="color: #000000; font-weight: bold;">new</span> Timer<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">10</span> <span style="color: #66cc66;">&#41;</span>;
		timer.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>TimerEvent.<span style="color: #006600;">TIMER</span>,handleTimer<span style="color: #66cc66;">&#41;</span>;
		timer.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">// listen (weak!!) to parent event - this is just for control purposes</span>
		parent.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">CHANGE</span> , handleChange , <span style="color: #000000; font-weight: bold;">false</span> , <span style="color: #cc66cc;">0</span> , <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">// let's have those sprites eat some memory while alive</span>
		<span style="color: #0066CC;">this</span>.<span style="color: #006600;">cacheAsBitmap</span> = <span style="color: #000000; font-weight: bold;">true</span>;
		graphics.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xff0000,<span style="color: #cc66cc;">0.1</span><span style="color: #66cc66;">&#41;</span>;
		graphics.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">500</span>,<span style="color: #cc66cc;">500</span><span style="color: #66cc66;">&#41;</span>;
		graphics.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> handleTimer<span style="color: #66cc66;">&#40;</span> event : TimerEvent <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #66cc66;">&#40;</span> event.<span style="color: #0066CC;">target</span> as Timer <span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>TimerEvent.<span style="color: #006600;">TIMER</span>,handleTimer<span style="color: #66cc66;">&#41;</span>;
		parent.<span style="color: #006600;">removeChild</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> handleChange<span style="color: #66cc66;">&#40;</span> event : Event <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
		MemoryLeakTest.<span style="color: #006600;">counter</span>++;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/09/09/garbage-collection-dictionary-listener/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Daily Live of Webdesigners</title>
		<link>http://blog.betabong.com/2009/08/03/daily-live-of-webdesigners/</link>
		<comments>http://blog.betabong.com/2009/08/03/daily-live-of-webdesigners/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 16:28:03 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=278</guid>
		<description><![CDATA[<p>You may have seen this. If not, it&#8217;s worth a watch:</p>
<p><object width="520" height="400"><param name="movie" value="http://www.youtube.com/v/JI3Df7-KFtw&#038;hl=en&#038;fs=1&#038;hd=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/JI3Df7-KFtw&#038;hl=en&#038;fs=1&#038;hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="520" height="400"></embed></object></p>
<p>No related posts.</p>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>You may have seen this. If not, it&#8217;s worth a watch:</p>
<p><object width="520" height="400"><param name="movie" value="http://www.youtube.com/v/JI3Df7-KFtw&#038;hl=en&#038;fs=1&#038;hd=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/JI3Df7-KFtw&#038;hl=en&#038;fs=1&#038;hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="520" height="400"></embed></object></p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/08/03/daily-live-of-webdesigners/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Switch Flash Browser Plugin on Mac OS X</title>
		<link>http://blog.betabong.com/2009/04/27/switch-flash-browser-plugin-mac/</link>
		<comments>http://blog.betabong.com/2009/04/27/switch-flash-browser-plugin-mac/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 13:12:35 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Frontend]]></category>
		<category><![CDATA[Browser]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[speed]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=273</guid>
		<description><![CDATA[<p>Sometimes you need to test your Flash stuff with different plugin versions. Even if you just want to run some <a href="/2009/04/05/flash-debug-speed/">performance tests</a>, it is very useful to switch to the release player (see below for another example).</p>
<p>For <a&#8230; <a href="http://blog.betabong.com/2009/04/27/switch-flash-browser-plugin-mac/" class="read_more">Read more</a></p>
Related posts:<ol>
<li><a href='http://blog.betabong.com/2009/04/05/flash-debug-speed/' rel='bookmark' title='Flash Debug Speed'>Flash Debug Speed</a></li>
<li><a href='http://blog.betabong.com/2008/12/06/test-flex-throttled-simulate-download/' rel='bookmark' title='Test Flex/Flash throttled (aka Simulate Download)'>Test Flex/Flash throttled (aka Simulate Download)</a></li>
<li><a href='http://blog.betabong.com/2008/08/22/flash-player-10-i-love-speed/' rel='bookmark' title='Flash Player 10 – I love speed'>Flash Player 10 – I love speed</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Sometimes you need to test your Flash stuff with different plugin versions. Even if you just want to run some <a href="/2009/04/05/flash-debug-speed/">performance tests</a>, it is very useful to switch to the release player (see below for another example).</p>
<p>For <a href="http://www.sephiroth.it/weblog/archives/2006/10/flash_switcher_for_firefox.php">windows there is a neat Firefox Plugin</a> that makes switching quite a snap. <a href="http://sephiroth.it/firefox/flash_switcher/">On Mac there is one too</a> – I haven&#8217;t tested it, but it&#8217;s supposed to work (though I&#8217;m not too sure about that when I read <a href="http://www.sephiroth.it/weblog/archives/2006/11/flash_switcher_for_osx.php#comments">these comments here</a>). Still I prefer to work with Safari and I kind of dislike the thought of starting Firefox to just switch Plugins.</p>
<p><a href="http://code.google.com/p/wspluginswitcher/" style="float: left; display: block; margin-right: 10pt; margin-bottom: 10pt;"><img src="http://blog.betabong.com/wp-content/uploads/2009/04/wspluginswitcher-icon.jpg" alt="wspluginswitcher-icon" title="wspluginswitcher-icon" width="128" height="128" class="alignleft size-full wp-image-274" /></a>Fortunately I&#8217;ve found another solution: <a href="http://code.google.com/p/wspluginswitcher/">WSPluginSwitcher</a>. This one comes as a Cocoa app and once configured (you really should <a href="http://code.google.com/p/wspluginswitcher/wiki/Setup">read this wiki page</a>), it works real well for me. Also they have <a href="http://code.google.com/p/wspluginswitcher/downloads/list">prepared plugin versions for you to download</a> (though the <a href="http://www.adobe.com/support/flashplayer/downloads.html">most recents</a> are missing, but no big deal really).</p>
<p>As for the speed tests, let me just give you another example (impressing enough for me to wanna switch players for real world testing).</p>
<p>In Debug Player:</p>
<pre>
method...................................................ttl ms...avg ms
tare [2]                                                      0     0.00
CSSFastParser                                               603   120.60
CSSRegExpParserFast                                         987   197.40
CSSRegExpParserFastAdvanced                                1457   291.40
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
</pre>
<p>In Release Player:</p>
<pre>
method...................................................ttl ms...avg ms
tare [2]                                                      0     0.00
CSSFastParser                                               354    70.80
CSSRegExpParserFast                                         972   194.40
CSSRegExpParserFastAdvanced                                1469   293.80
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
</pre>
<p>Both 10.0.22.87, and exported as release swf. Oh, and by the way tested with another useful tool from Grant Skinner: <a href="http://www.gskinner.com/blog/archives/2009/04/as3_performance.html">AS3 Performance Testing Harness</a>.</p>
<p>Related posts:<ol>
<li><a href='http://blog.betabong.com/2009/04/05/flash-debug-speed/' rel='bookmark' title='Flash Debug Speed'>Flash Debug Speed</a></li>
<li><a href='http://blog.betabong.com/2008/12/06/test-flex-throttled-simulate-download/' rel='bookmark' title='Test Flex/Flash throttled (aka Simulate Download)'>Test Flex/Flash throttled (aka Simulate Download)</a></li>
<li><a href='http://blog.betabong.com/2008/08/22/flash-player-10-i-love-speed/' rel='bookmark' title='Flash Player 10 – I love speed'>Flash Player 10 – I love speed</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/04/27/switch-flash-browser-plugin-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BBML Presentation at SFUG</title>
		<link>http://blog.betabong.com/2009/04/22/bbml-presentation/</link>
		<comments>http://blog.betabong.com/2009/04/22/bbml-presentation/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 08:02:14 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Frontend]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[bbml]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[sfug]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=262</guid>
		<description><![CDATA[<p>Yesterday I had a presentation at the <a href="http://www.sfug.ch/?p=123">SFUG meeting</a> covering some bits of my rewritten BBML framework (originated from the project laax.com). I&#8217;ve tried to share some insights into the technical concept and strategies for CSS parsing, <a href="http://en.wikipedia.org/wiki/CSS_selector">CSS</a>&#8230; <a href="http://blog.betabong.com/2009/04/22/bbml-presentation/" class="read_more">Read more</a></p>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Yesterday I had a presentation at the <a href="http://www.sfug.ch/?p=123">SFUG meeting</a> covering some bits of my rewritten BBML framework (originated from the project laax.com). I&#8217;ve tried to share some insights into the technical concept and strategies for CSS parsing, <a href="http://en.wikipedia.org/wiki/CSS_selector">CSS selectors</a> and layout validation.</p>
<p><img src="http://blog.betabong.com/wp-content/uploads/2009/04/sfug-pres.jpg" alt="Sev presenting..." title="Sev presenting..." width="520" height="390" class="alignnone size-full wp-image-266" /><br />
<small>Picture by <a href="http://www.entropy.ch/about/welcome.html">Marc Liyanage</a></small></p>
<p>It&#8217;s been surprisingly fun (I give credits to the beer sponsored by <a href="http://www.nemos.ch/">Nemos</a>). People even managed to pretend they&#8217;d be interested in what I was prosing, so credit to them too!</p>
<p><a href="http://www.flashatthelake.ch" style="float: right; display: block; margin-left: 10pt; margin-bottom: 10pt;"><img src="http://fatl.ch/banners/fatl_button3_120x60.gif" width="120" height="60" hspace="10" vspace="10" border="0" alt="Flash at the lake Swiss Flash User Group Conference." /></a> I&#8217;d also like to mention that there&#8217;ll be <strong>the</strong> swiss flash event soon: Flash at the Lake will not only pamper you with appearances of <a href="http://fatl.ch/?page_id=16">great national and international Flash enthustiacs</a>, it will also give anybody attending the pleasure to enjoy one of Zurich&#8217;s greatest locations with people who don&#8217;t think of you as a storm lightning adorer when you sit in the sun twittering Flash into the clear lake. And all that to a fantastic price. Check it out at <a href="http://fatl.ch">fatl.ch</a></p>
<p>So here we go with the presentation (<a href="http://www.apple.com/quicktime/download/">Quicktime</a> so you can enjoy the marvelous effects):</p>
<p><object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="520" height="390"><param name="src" value="/wp-content/uploads/2009/04/sfug-presentation-bbml-hq.mov" /><param name="controller" value="true" /><param name="autoplay" value="false" /><param name="scale" value="aspect" /><object type="video/quicktime" data="/wp-content/uploads/2009/04/sfug-presentation-bbml-hq.mov" width="520" height="390">
<param name="autoplay" value="false" /><param name="controller" value="true" /><param name="scale" value="aspect" /></object></object></p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/04/22/bbml-presentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>links for 2009-04-18</title>
		<link>http://blog.betabong.com/2009/04/19/links-for-2009-04-18/</link>
		<comments>http://blog.betabong.com/2009/04/19/links-for-2009-04-18/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 01:30:25 +0000</pubDate>
		<dc:creator>delicious</dc:creator>
				<category><![CDATA[]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/2009/04/19/links-for-2009-04-18/</guid>
		<description><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://atelier.ie/">Atelier David Smith</a></div>
<div class="delicious-extended">A simple but beautifully executed idea. You can resize, navigate by keyboard .. many details I like. Only thing: no mouse wheel support and not too nice aliased font in content section.</div></li></ul><p>&#8230; <a href="http://blog.betabong.com/2009/04/19/links-for-2009-04-18/" class="read_more">Read more</a></p>
No related posts.]]></description>
			<content:encoded><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://atelier.ie/">Atelier David Smith</a></div>
<div class="delicious-extended">A simple but beautifully executed idea. You can resize, navigate by keyboard .. many details I like. Only thing: no mouse wheel support and not too nice aliased font in content section.</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/flash">flash</a> <a href="http://delicious.com/sok/inspiration">inspiration</a> <a href="http://delicious.com/sok/portfolio">portfolio</a> <a href="http://delicious.com/sok/typography">typography</a> <a href="http://delicious.com/sok/agency">agency</a>)</div>
</li>
<li>
<div class="delicious-link"><a href="http://www.arias.ca/">David Arias &#8211; Portfolio</a></div>
<div class="delicious-extended">It&#39;s refreshing to see something so clean and simple, yet pretty. No effects, no animation. Clean and slick.</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/inspiration">inspiration</a> <a href="http://delicious.com/sok/portfolio">portfolio</a> <a href="http://delicious.com/sok/html">html</a>)</div>
</li>
</ul>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/04/19/links-for-2009-04-18/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MetaTunnel with Pixel Bender</title>
		<link>http://blog.betabong.com/2009/04/17/metatunnel-with-pixel-bender/</link>
		<comments>http://blog.betabong.com/2009/04/17/metatunnel-with-pixel-bender/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 21:37:31 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[Labs]]></category>
		<category><![CDATA[Pixel Bender]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=252</guid>
		<description><![CDATA[<p>This is a follow-up of <a href="/2009/04/13/metatunnel-1k-demo-as-vs-js/">this</a>.</p>
<p><img src="http://blog.betabong.com/wp-content/uploads/2009/04/metatunnel-pixelbender.jpg" alt="metatunnel-pixelbender" title="metatunnel-pixelbender" width="512" height="512" class="alignnone size-full wp-image-254" /></p>
<p>Yeah well, I was more than optimistic to show <a href="http://demoscene.appjet.net/">those JS guys</a> how fast Flash can be with the help of some brand new Adobe magic – but Pixel Bender was, unfortunately,&#8230; <a href="http://blog.betabong.com/2009/04/17/metatunnel-with-pixel-bender/" class="read_more">Read more</a></p>
Related posts:<ol>
<li><a href='http://blog.betabong.com/2009/04/13/metatunnel-1k-demo-as-vs-js/' rel='bookmark' title='Metatunnel 1k Demo: AS vs. JS'>Metatunnel 1k Demo: AS vs. JS</a></li>
<li><a href='http://blog.betabong.com/2009/04/13/gridfittype-animation/' rel='bookmark' title='GridFitType (&amp; animation)'>GridFitType (&#038; animation)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This is a follow-up of <a href="/2009/04/13/metatunnel-1k-demo-as-vs-js/">this</a>.</p>
<p><img src="http://blog.betabong.com/wp-content/uploads/2009/04/metatunnel-pixelbender.jpg" alt="metatunnel-pixelbender" title="metatunnel-pixelbender" width="512" height="512" class="alignnone size-full wp-image-254" /></p>
<p>Yeah well, I was more than optimistic to show <a href="http://demoscene.appjet.net/">those JS guys</a> how fast Flash can be with the help of some brand new Adobe magic – but Pixel Bender was, unfortunately, quite disappointing:<br />
<span id="more-252"></span></p>
<ol>
<li>I spent hours to successfully migrate the code to Pixel Bender Toolkit (wasn&#8217;t that difficult actually, but a wrong character there and your math is all screwed up). So here the first letdown: Pixel Bender Toolkit is <strong>not a very nice coding environment</strong>. It&#8217;s a rough baby. But I&#8217;d do everything for speed :-)..</li>
<li>Once I had it running (the above picture is captured from Pixel Bender) I tried to export it for Flash Player. But hoohoo! <strong>no support for loops</strong> in Flash Player! Yeah, well, ..(and also <strong>no custom functions</strong> by the way)</li>
<li>But I didn&#8217;t give up. I just calculated how many max loops where needed (about 100) and replicated the while loop with many if-conditions (I love to do computer&#8217;s dummy job ;). Then finally: Export to Flash Player! But in Flash Player having the shader as Filter for a BitmapData just <strong>really fucked up the rendering</strong>. I even went down to 1fps, but still no luck. What a bummer! (sometimes I saw a few pixels blue, but very unusable: I&#8217;ve written <a href="http://forums.adobe.com/thread/419485">to the Pixel Bender Forum </a>- invited by <a href="http://twitter.com/pixelbender">@Pixelbender</a> – but that led to nothing so far).</li>
<li>Today, finally, I got it working by taking a more rough approach (not BitmapFilter, but ShaderJob). <strong>But hell is it slow!!!</strong> And it eats all my 8 cpu cores!! So I wondered how that could be: Fast as hell in Pixel Bender Toolkit (uses may be 2% of my cpu at full fps!), but slow as hell in Flash Player?! The answer is obvious: <strong>Adobe decided not to talk to the GCU (Graphics Card)</strong> for the calculations, probably to keep the Flash Player be as platform independent as possible &#8211; and as small as possible. But then I wonder.. WTF do you give us this toy if we can&#8217;t use it?!! It&#8217;s like Apple would say: «Great news: we have Core Graphics on the iPhone &#8211; without hardware acceleration..» Adobe, to me, this doesn&#8217;t make too much sense. (But I&#8217;m so very much pleased about the new Text Engine – *that* was a good job)</li>
</ol>
<p>Here the result: (Click to start, it&#8217;ll eat your cpu!)</p>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_0" width="520" height="128">
      <param name="movie" value="/wp-content/uploads/flash/MetaTunnelBender.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="/wp-content/uploads/flash/MetaTunnelBender.swf" width="520" height="128">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>

<p>And for the geeks, here we go with the source codes:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>languageVersion <span style="color: #339933;">:</span> <span style="color: #CC0000;">1.0</span><span style="color: #339933;">;&gt;</span>
&nbsp;
kernel MetaTunnel
<span style="color: #339933;">&lt;</span>   <span style="color: #003366; font-weight: bold;">namespace</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;com.betabong&quot;</span><span style="color: #339933;">;</span>
    vendor <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Betabong&quot;</span><span style="color: #339933;">;</span>
    version <span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
    description <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;MetaTunnel Port&quot;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #009900;">&#123;</span>
    parameter int size
    <span style="color: #339933;">&lt;</span>
        minValue<span style="color: #339933;">:</span> <span style="color: #CC0000;">16</span><span style="color: #339933;">;</span>
        maxValue<span style="color: #339933;">:</span> <span style="color: #CC0000;">512</span><span style="color: #339933;">;</span>
        defaultValue<span style="color: #339933;">:</span> <span style="color: #CC0000;">128</span><span style="color: #339933;">;</span>
    <span style="color: #339933;">&gt;;</span>
&nbsp;
&nbsp;
    parameter float time
    <span style="color: #339933;">&lt;</span>
        minValue<span style="color: #339933;">:</span> float<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">0.0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        maxValue<span style="color: #339933;">:</span> float<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">15.0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        defaultValue<span style="color: #339933;">:</span> float<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">0.0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #339933;">&gt;;</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
    input image4 src<span style="color: #339933;">;</span>
    output pixel3 dst<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">void</span>
    evaluatePixel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        float cos1 <span style="color: #339933;">=</span> cos<span style="color: #009900;">&#40;</span> time <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        float cos0_5 <span style="color: #339933;">=</span> cos<span style="color: #009900;">&#40;</span>time <span style="color: #339933;">*</span> <span style="color: #CC0000;">0.5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        float cos0_7 <span style="color: #339933;">=</span> cos<span style="color: #009900;">&#40;</span>time <span style="color: #339933;">*</span> <span style="color: #CC0000;">0.7</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        float sin1 <span style="color: #339933;">=</span> sin<span style="color: #009900;">&#40;</span> time <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        float sin0_2 <span style="color: #339933;">=</span> sin<span style="color: #009900;">&#40;</span>time <span style="color: #339933;">*</span> <span style="color: #CC0000;">0.2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        float sin_0_5 <span style="color: #339933;">=</span> sin<span style="color: #009900;">&#40;</span>time <span style="color: #339933;">*</span> <span style="color: #CC0000;">0.5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        float dim <span style="color: #339933;">=</span> float<span style="color: #009900;">&#40;</span> size <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        float2 point <span style="color: #339933;">=</span> outCoord<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> dim<span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> point.<span style="color: #660066;">x</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">1.0</span> <span style="color: #339933;">||</span> point.<span style="color: #660066;">y</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">1.0</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            dst.<span style="color: #660066;">rgb</span> <span style="color: #339933;">=</span> float3<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">1.0</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">1.0</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">1.0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        float2 vp <span style="color: #339933;">=</span> float2<span style="color: #009900;">&#40;</span> point.<span style="color: #660066;">x</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">2.0</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">1.0</span> <span style="color: #339933;">,</span> <span style="color: #339933;">-</span>point.<span style="color: #660066;">y</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">2.0</span> <span style="color: #339933;">+</span> <span style="color: #CC0000;">1.0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        float s <span style="color: #339933;">=</span> float<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">0.4</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        float3 op <span style="color: #339933;">=</span> float3<span style="color: #009900;">&#40;</span> vp.<span style="color: #660066;">x</span> <span style="color: #339933;">,</span> vp.<span style="color: #660066;">y</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">1.25</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">0.0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        float3 dp <span style="color: #339933;">=</span> float3<span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span>vp.<span style="color: #660066;">x</span> <span style="color: #339933;">+</span> cos1 <span style="color: #339933;">*</span> <span style="color: #CC0000;">0.3</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #CC0000;">64.0</span> <span style="color: #339933;">,</span> vp.<span style="color: #660066;">y</span><span style="color: #339933;">/</span><span style="color: #CC0000;">64.0</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">1.0</span><span style="color: #339933;">/</span><span style="color: #CC0000;">64.0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        float f <span style="color: #339933;">=</span> float<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">1.0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        float tt <span style="color: #339933;">=</span> float<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">0.0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        float g <span style="color: #339933;">=</span> float<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">1.0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        float3 p <span style="color: #339933;">=</span> float3<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1.0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1.0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span>g <span style="color: #339933;">&gt;</span> s<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>tt<span style="color: #339933;">&lt;</span><span style="color: #CC0000;">375.0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            p <span style="color: #339933;">=</span> op <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span> dp <span style="color: #339933;">*</span> tt <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            f <span style="color: #339933;">=</span> <span style="color: #CC0000;">1.0</span><span style="color: #339933;">;</span>
            f <span style="color: #339933;">*=</span> abs<span style="color: #009900;">&#40;</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> cos1<span style="color: #339933;">+</span>sin0_2 <span style="color: #339933;">,</span> <span style="color: #CC0000;">0.3</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span><span style="color: #339933;">+</span>cos0_5<span style="color: #339933;">*</span><span style="color: #CC0000;">0.5</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            f <span style="color: #339933;">*=</span> abs<span style="color: #009900;">&#40;</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span>cos0_7 <span style="color: #339933;">,</span> <span style="color: #CC0000;">0.3</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span><span style="color: #339933;">+</span>sin_0_5 <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            f <span style="color: #339933;">*=</span> abs<span style="color: #009900;">&#40;</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span>sin0_2<span style="color: #339933;">*</span><span style="color: #CC0000;">0.5</span> <span style="color: #339933;">,</span> sin1 <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            f <span style="color: #339933;">*=</span> cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">x</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">0.1</span> <span style="color: #339933;">-</span> cos<span style="color: #009900;">&#40;</span> p.<span style="color: #660066;">z</span><span style="color: #339933;">*</span><span style="color: #CC0000;">7.0</span> <span style="color: #339933;">+</span> time<span style="color: #339933;">*</span><span style="color: #CC0000;">7.0</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">x</span><span style="color: #339933;">*</span><span style="color: #CC0000;">3.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">y</span><span style="color: #339933;">*</span><span style="color: #CC0000;">4.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #CC0000;">0.1</span><span style="color: #339933;">;</span>
            g <span style="color: #339933;">=</span> f<span style="color: #339933;">;</span>
            tt <span style="color: #339933;">+=</span> g <span style="color: #339933;">*</span> <span style="color: #CC0000;">4.0</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        float color <span style="color: #339933;">=</span> <span style="color: #CC0000;">0.0</span><span style="color: #339933;">;</span>
        float3 dtt <span style="color: #339933;">=</span> op <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span> dp <span style="color: #339933;">*</span> tt<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        p <span style="color: #339933;">=</span> float3<span style="color: #009900;">&#40;</span> dtt.<span style="color: #660066;">x</span> <span style="color: #339933;">,</span> dtt.<span style="color: #660066;">y</span> <span style="color: #339933;">,</span> dtt.<span style="color: #660066;">z</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">=</span> <span style="color: #CC0000;">1.0</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">*=</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> cos1<span style="color: #339933;">+</span>sin0_2 <span style="color: #339933;">,</span> <span style="color: #CC0000;">0.3</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span><span style="color: #339933;">+</span>cos0_5<span style="color: #339933;">*</span><span style="color: #CC0000;">0.5</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">*=</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span>cos0_7 <span style="color: #339933;">,</span> <span style="color: #CC0000;">0.3</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span><span style="color: #339933;">+</span>sin_0_5 <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            f <span style="color: #339933;">*=</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span>sin0_2<span style="color: #339933;">*</span><span style="color: #CC0000;">0.5</span> <span style="color: #339933;">,</span> sin1 <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">*=</span> cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">x</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #CC0000;">0.1</span><span style="color: #339933;">-</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">z</span><span style="color: #339933;">*</span><span style="color: #CC0000;">7.0</span><span style="color: #339933;">+</span>time<span style="color: #339933;">*</span><span style="color: #CC0000;">7.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">x</span><span style="color: #339933;">*</span><span style="color: #CC0000;">3.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">y</span><span style="color: #339933;">*</span><span style="color: #CC0000;">4.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #CC0000;">0.1</span><span style="color: #339933;">;</span>
        float objd <span style="color: #339933;">=</span> f<span style="color: #339933;">;</span>
&nbsp;
        float3 np <span style="color: #339933;">=</span> float3<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">0.0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0.0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0.0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        p <span style="color: #339933;">=</span> float3<span style="color: #009900;">&#40;</span> dtt.<span style="color: #660066;">x</span> <span style="color: #339933;">+</span> <span style="color: #CC0000;">0.01</span> <span style="color: #339933;">,</span> dtt.<span style="color: #660066;">y</span> <span style="color: #339933;">,</span> dtt.<span style="color: #660066;">z</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">=</span> <span style="color: #CC0000;">1.0</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">*=</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> cos1<span style="color: #339933;">+</span>sin0_2 <span style="color: #339933;">,</span> <span style="color: #CC0000;">0.3</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span><span style="color: #339933;">+</span>cos0_5<span style="color: #339933;">*</span><span style="color: #CC0000;">0.5</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">*=</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span>cos0_7 <span style="color: #339933;">,</span> <span style="color: #CC0000;">0.3</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span><span style="color: #339933;">+</span>sin_0_5 <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            f <span style="color: #339933;">*=</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span>sin0_2<span style="color: #339933;">*</span><span style="color: #CC0000;">0.5</span> <span style="color: #339933;">,</span> sin1 <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">*=</span> cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">x</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #CC0000;">0.1</span><span style="color: #339933;">-</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">z</span><span style="color: #339933;">*</span><span style="color: #CC0000;">7.0</span><span style="color: #339933;">+</span>time<span style="color: #339933;">*</span><span style="color: #CC0000;">7.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">x</span><span style="color: #339933;">*</span><span style="color: #CC0000;">3.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">y</span><span style="color: #339933;">*</span><span style="color: #CC0000;">4.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #CC0000;">0.1</span><span style="color: #339933;">;</span>
        np.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> objd <span style="color: #339933;">-</span> f<span style="color: #339933;">;</span>
&nbsp;
        p <span style="color: #339933;">=</span> float3<span style="color: #009900;">&#40;</span> dtt.<span style="color: #660066;">x</span> <span style="color: #339933;">,</span> dtt.<span style="color: #660066;">y</span> <span style="color: #339933;">+</span> <span style="color: #CC0000;">0.01</span> <span style="color: #339933;">,</span> dtt.<span style="color: #660066;">z</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">=</span> <span style="color: #CC0000;">1.0</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">*=</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> cos1<span style="color: #339933;">+</span>sin0_2 <span style="color: #339933;">,</span> <span style="color: #CC0000;">0.3</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span><span style="color: #339933;">+</span>cos0_5<span style="color: #339933;">*</span><span style="color: #CC0000;">0.5</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">*=</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span>cos0_7 <span style="color: #339933;">,</span> <span style="color: #CC0000;">0.3</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span><span style="color: #339933;">+</span>sin_0_5 <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            f <span style="color: #339933;">*=</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span>sin0_2<span style="color: #339933;">*</span><span style="color: #CC0000;">0.5</span> <span style="color: #339933;">,</span> sin1 <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">*=</span> cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">x</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #CC0000;">0.1</span><span style="color: #339933;">-</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">z</span><span style="color: #339933;">*</span><span style="color: #CC0000;">7.0</span><span style="color: #339933;">+</span>time<span style="color: #339933;">*</span><span style="color: #CC0000;">7.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">x</span><span style="color: #339933;">*</span><span style="color: #CC0000;">3.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">y</span><span style="color: #339933;">*</span><span style="color: #CC0000;">4.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #CC0000;">0.1</span><span style="color: #339933;">;</span>
        np.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> objd <span style="color: #339933;">-</span> f<span style="color: #339933;">;</span>
&nbsp;
        p <span style="color: #339933;">=</span> float3<span style="color: #009900;">&#40;</span> dtt.<span style="color: #660066;">x</span> <span style="color: #339933;">,</span> dtt.<span style="color: #660066;">y</span> <span style="color: #339933;">,</span> dtt.<span style="color: #660066;">z</span> <span style="color: #339933;">+</span> <span style="color: #CC0000;">0.01</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">=</span> <span style="color: #CC0000;">1.0</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">*=</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> cos1<span style="color: #339933;">+</span>sin0_2 <span style="color: #339933;">,</span> <span style="color: #CC0000;">0.3</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span><span style="color: #339933;">+</span>cos0_5<span style="color: #339933;">*</span><span style="color: #CC0000;">0.5</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">*=</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span>cos0_7 <span style="color: #339933;">,</span> <span style="color: #CC0000;">0.3</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span><span style="color: #339933;">+</span>sin_0_5 <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            f <span style="color: #339933;">*=</span> distance<span style="color: #009900;">&#40;</span> float3<span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span>sin0_2<span style="color: #339933;">*</span><span style="color: #CC0000;">0.5</span> <span style="color: #339933;">,</span> sin1 <span style="color: #339933;">,</span> <span style="color: #CC0000;">2.0</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> p <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        f <span style="color: #339933;">*=</span> cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">x</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #CC0000;">0.1</span><span style="color: #339933;">-</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">z</span><span style="color: #339933;">*</span><span style="color: #CC0000;">7.0</span><span style="color: #339933;">+</span>time<span style="color: #339933;">*</span><span style="color: #CC0000;">7.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">x</span><span style="color: #339933;">*</span><span style="color: #CC0000;">3.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>cos<span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">y</span><span style="color: #339933;">*</span><span style="color: #CC0000;">4.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #CC0000;">0.1</span><span style="color: #339933;">;</span>
        np.<span style="color: #660066;">z</span> <span style="color: #339933;">=</span> objd <span style="color: #339933;">-</span> f<span style="color: #339933;">;</span>
&nbsp;
        float d <span style="color: #339933;">=</span> length<span style="color: #009900;">&#40;</span> np <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        np.<span style="color: #660066;">y</span> <span style="color: #339933;">/=</span> d<span style="color: #339933;">;</span>
        np.<span style="color: #660066;">z</span> <span style="color: #339933;">/=</span> d<span style="color: #339933;">;</span>
&nbsp;
        color <span style="color: #339933;">=</span> max<span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">0.5</span> <span style="color: #339933;">*</span> np.<span style="color: #660066;">z</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">0.0</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> max<span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">0.5</span> <span style="color: #339933;">*</span>np.<span style="color: #660066;">y</span> <span style="color: #339933;">+</span> <span style="color: #CC0000;">0.5</span> <span style="color: #339933;">*</span> np.<span style="color: #660066;">z</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">0.0</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">0.5</span><span style="color: #339933;">;</span>
        float3 rgb <span style="color: #339933;">=</span> float3<span style="color: #009900;">&#40;</span>color  <span style="color: #339933;">+</span> <span style="color: #CC0000;">0.1</span> <span style="color: #339933;">*</span> tt <span style="color: #339933;">*</span> <span style="color: #CC0000;">0.025</span> <span style="color: #339933;">,</span> color  <span style="color: #339933;">+</span> <span style="color: #CC0000;">0.2</span> <span style="color: #339933;">*</span> tt <span style="color: #339933;">*</span> <span style="color: #CC0000;">0.025</span>  <span style="color: #339933;">,</span> color <span style="color: #339933;">+</span> <span style="color: #CC0000;">0.5</span> <span style="color: #339933;">*</span> tt <span style="color: #339933;">*</span> <span style="color: #CC0000;">0.025</span>   <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        rgb.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> max<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">0.0</span> <span style="color: #339933;">,</span> min<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">1.0</span> <span style="color: #339933;">,</span> rgb.<span style="color: #660066;">x</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        rgb.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> max<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">0.0</span> <span style="color: #339933;">,</span> min<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">1.0</span> <span style="color: #339933;">,</span> rgb.<span style="color: #660066;">y</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        rgb.<span style="color: #660066;">z</span> <span style="color: #339933;">=</span> max<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">0.0</span> <span style="color: #339933;">,</span> min<span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">1.0</span> <span style="color: #339933;">,</span> rgb.<span style="color: #660066;">z</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        dst.<span style="color: #660066;">rgb</span> <span style="color: #339933;">=</span> rgb<span style="color: #339933;">;</span>
&nbsp;
&nbsp;
      <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And here the Actionscript part:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package
 <span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #66cc66;">*</span>;
    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #66cc66;">*</span>;
    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">filters</span>.<span style="color: #66cc66;">*</span>;
    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #66cc66;">*</span>;
    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">ByteArray</span>;
&nbsp;
    <span style="color: #0066CC;">import</span> net.<span style="color: #006600;">hires</span>.<span style="color: #006600;">debug</span>.<span style="color: #006600;">Stats</span>;
    <span style="color: #808080; font-style: italic;">// SWF Metadata </span>
    <span style="color: #66cc66;">&#91;</span>SWF<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">width</span> = <span style="color: #ff0000;">&quot;520&quot;</span>, <span style="color: #0066CC;">height</span> = <span style="color: #ff0000;">&quot;128&quot;</span>, <span style="color: #0066CC;">backgroundColor</span> = <span style="color: #ff0000;">&quot;#000000&quot;</span>, framerate = <span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MetaTunnelBender <span style="color: #0066CC;">extends</span> Sprite <span style="color: #66cc66;">&#123;</span>
&nbsp;
        <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;test/MetaTunnel-stupid.pbj&quot;</span>, mimeType = <span style="color: #ff0000;">&quot;application/octet-stream&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> TestFilter: <span style="color: #000000; font-weight: bold;">Class</span>;
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> playing : <span style="color: #0066CC;">Boolean</span>;
&nbsp;
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> im: Bitmap;
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> job:ShaderJob;
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> shader: Shader;
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> shaderfilter:ByteArray;
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">time</span>:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0.0</span>;
        <span style="color: #0066CC;">private</span> const <span style="color: #0066CC;">SIZE</span>:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">64</span>;
        <span style="color: #0066CC;">private</span> const WHITE:BitmapData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">SIZE</span> , <span style="color: #0066CC;">SIZE</span> , <span style="color: #000000; font-weight: bold;">false</span> , 0xffffff <span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MetaTunnelBender<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
        	<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">frameRate</span> = <span style="color: #cc66cc;">20</span>;
            im = <span style="color: #000000; font-weight: bold;">new</span> Bitmap<span style="color: #66cc66;">&#40;</span> WHITE.<span style="color: #006600;">clone</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
            im.<span style="color: #006600;">scaleX</span> = im.<span style="color: #006600;">scaleY</span> = <span style="color: #cc66cc;">2</span>;
            addChild<span style="color: #66cc66;">&#40;</span>im<span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// stat info</span>
            <span style="color: #000000; font-weight: bold;">var</span> s:DisplayObject = <span style="color: #000000; font-weight: bold;">new</span> Stats<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            addChild<span style="color: #66cc66;">&#40;</span> s <span style="color: #66cc66;">&#41;</span>;
            s.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">128</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">//Pass the embedded filter to the Shader as a ByteArray </span>
            shaderfilter = <span style="color: #000000; font-weight: bold;">new</span> TestFilter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as ByteArray;
            shader = <span style="color: #000000; font-weight: bold;">new</span> Shader<span style="color: #66cc66;">&#40;</span> shaderfilter <span style="color: #66cc66;">&#41;</span>;
            shader.<span style="color: #0066CC;">data</span>.<span style="color: #0066CC;">size</span>.<span style="color: #006600;">value</span> = <span style="color: #66cc66;">&#91;</span> <span style="color: #0066CC;">SIZE</span> <span style="color: #66cc66;">&#93;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">//start shaderjob (async start won't work - bug?)            </span>
            job = <span style="color: #000000; font-weight: bold;">new</span> ShaderJob<span style="color: #66cc66;">&#40;</span> shader , im.<span style="color: #006600;">bitmapData</span> , im.<span style="color: #0066CC;">width</span> , im.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">&#41;</span>;
			job.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// let's start/stop on click</span>
			<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">CLICK</span> , click <span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// render first frame</span>
			enterframe<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> enterframe<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:Event = <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
        	<span style="color: #0066CC;">time</span> += <span style="color: #cc66cc;">0.05</span>;
			shader.<span style="color: #0066CC;">data</span>.<span style="color: #0066CC;">time</span>.<span style="color: #006600;">value</span> = <span style="color: #66cc66;">&#91;</span> <span style="color: #0066CC;">time</span> <span style="color: #66cc66;">&#93;</span>;
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> job.<span style="color: #006600;">progress</span> <span style="color: #66cc66;">&#41;</span>;
            job = <span style="color: #000000; font-weight: bold;">new</span> ShaderJob<span style="color: #66cc66;">&#40;</span> shader , im.<span style="color: #006600;">bitmapData</span> , im.<span style="color: #0066CC;">width</span> , im.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">&#41;</span>;
			job.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
       <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> click<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:<span style="color: #66cc66;">*</span> = <span style="color: #000000; font-weight: bold;">null</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> <span style="color: #66cc66;">!</span>playing <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	           addEventListener<span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">ENTER_FRAME</span> , enterframe <span style="color: #66cc66;">&#41;</span>;
	        <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
	           removeEventListener<span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">ENTER_FRAME</span> , enterframe <span style="color: #66cc66;">&#41;</span>;
	        <span style="color: #66cc66;">&#125;</span>
	        playing = <span style="color: #66cc66;">!</span>playing;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Related posts:<ol>
<li><a href='http://blog.betabong.com/2009/04/13/metatunnel-1k-demo-as-vs-js/' rel='bookmark' title='Metatunnel 1k Demo: AS vs. JS'>Metatunnel 1k Demo: AS vs. JS</a></li>
<li><a href='http://blog.betabong.com/2009/04/13/gridfittype-animation/' rel='bookmark' title='GridFitType (&amp; animation)'>GridFitType (&#038; animation)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/04/17/metatunnel-with-pixel-bender/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Metatunnel 1k Demo: AS vs. JS</title>
		<link>http://blog.betabong.com/2009/04/13/metatunnel-1k-demo-as-vs-js/</link>
		<comments>http://blog.betabong.com/2009/04/13/metatunnel-1k-demo-as-vs-js/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 10:16:17 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=245</guid>
		<description><![CDATA[<p>I did a quick port of a «graphic demo» called <a href="http://www.pouet.net/prod.php?which=52777">«metatunnel» (created by FRequency).</a></p>
<p><a href="http://demoscene.appjet.net/">Paulo Falcão ported this to Javascript</a> using canvas.</p>
<p>To make the set complete I ported Paulos JS version to Actionscript, just quick&#8217;n'dirty.</p>
<p>Click on it&#8230; <a href="http://blog.betabong.com/2009/04/13/metatunnel-1k-demo-as-vs-js/" class="read_more">Read more</a></p>
Related posts:<ol>
<li><a href='http://blog.betabong.com/2009/04/17/metatunnel-with-pixel-bender/' rel='bookmark' title='MetaTunnel with Pixel Bender'>MetaTunnel with Pixel Bender</a></li>
<li><a href='http://blog.betabong.com/2008/09/26/weak-method-closure/' rel='bookmark' title='Weak Method Closure'>Weak Method Closure</a></li>
<li><a href='http://blog.betabong.com/2009/03/05/javascript-canvas-3d/' rel='bookmark' title='3D Point Cloud with Javascript and Canvas'>3D Point Cloud with Javascript and Canvas</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I did a quick port of a «graphic demo» called <a href="http://www.pouet.net/prod.php?which=52777">«metatunnel» (created by FRequency).</a></p>
<p><a href="http://demoscene.appjet.net/">Paulo Falcão ported this to Javascript</a> using canvas.</p>
<p>To make the set complete I ported Paulos JS version to Actionscript, just quick&#8217;n'dirty.</p>
<p>Click on it to start the animation:</p>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_1" width="128" height="128">
      <param name="movie" value="/wp-content/uploads/flash/MetaTunnel.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="/wp-content/uploads/flash/MetaTunnel.swf" width="128" height="128">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>

<p><span id="more-245"></span></p>
<p>Here&#8217;s the code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package test
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Bitmap</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">BitmapData</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> JSCanvasPort <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> JSCanvasPort<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			addChild<span style="color: #66cc66;">&#40;</span> canvas = <span style="color: #000000; font-weight: bold;">new</span> Bitmap<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
			canvas.<span style="color: #0066CC;">smoothing</span> = <span style="color: #000000; font-weight: bold;">false</span>;
			canvas.<span style="color: #006600;">scaleX</span> = canvas.<span style="color: #006600;">scaleY</span> = <span style="color: #cc66cc;">2</span>;
			draw<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			addEventListener<span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">CLICK</span> , handleClick <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> playing:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">false</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> handleClick<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:Event = <span style="color: #000000; font-weight: bold;">null</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> playing <span style="color: #66cc66;">&#41;</span>
				removeEventListener<span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">ENTER_FRAME</span> , enterframe <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">else</span>
				addEventListener<span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">ENTER_FRAME</span> , enterframe <span style="color: #66cc66;">&#41;</span>;
			playing = <span style="color: #66cc66;">!</span>playing;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> enterframe<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:Event=<span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			draw<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">time</span>:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> maxr:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">64.0</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> canvas:Bitmap;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> distance<span style="color: #66cc66;">&#40;</span>ax:<span style="color: #0066CC;">Number</span>,ay:<span style="color: #0066CC;">Number</span>,az:<span style="color: #0066CC;">Number</span>,bx:<span style="color: #0066CC;">Number</span>,by:<span style="color: #0066CC;">Number</span>,bz:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> dx:<span style="color: #0066CC;">Number</span>=bx-ax , dy:<span style="color: #0066CC;">Number</span>=by-ay , dz:<span style="color: #0066CC;">Number</span>=bz-az;
		    <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sqrt</span><span style="color: #66cc66;">&#40;</span> dx<span style="color: #66cc66;">*</span>dx + dy<span style="color: #66cc66;">*</span>dy + dz<span style="color: #66cc66;">*</span>dz <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> obj<span style="color: #66cc66;">&#40;</span>x:<span style="color: #0066CC;">Number</span>,y:<span style="color: #0066CC;">Number</span>,z:<span style="color: #0066CC;">Number</span>,t:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#123;</span>
		        <span style="color: #000000; font-weight: bold;">var</span> f:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">1.0</span>;
		        f<span style="color: #66cc66;">*</span>=distance<span style="color: #66cc66;">&#40;</span>x,y,z,<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span>t<span style="color: #66cc66;">&#41;</span>+<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span>t<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">0.2</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;">0.3</span>,<span style="color: #cc66cc;">2.0</span>+<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span>t<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">&#41;</span>;
		        f<span style="color: #66cc66;">*</span>=distance<span style="color: #66cc66;">&#40;</span>x,y,z,-<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span>t<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">0.7</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;">0.3</span>,<span style="color: #cc66cc;">2.0</span>+<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span>t<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
		        f<span style="color: #66cc66;">*</span>=distance<span style="color: #66cc66;">&#40;</span>x,y,z,-<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span>t<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">0.2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">0.5</span>,<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span>t<span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;">2.0</span><span style="color: #66cc66;">&#41;</span>;
		        f<span style="color: #66cc66;">*</span>=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span>y<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span>x<span style="color: #66cc66;">&#41;</span>-<span style="color: #cc66cc;">0.1</span>-<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span>z<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">7.0</span>+t<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">7.0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span>x<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">3.0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span>y<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">4.0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">0.1</span>;
		        <span style="color: #b1b100;">return</span> f;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">eval</span><span style="color: #66cc66;">&#40;</span>x:<span style="color: #0066CC;">Number</span>,y:<span style="color: #0066CC;">Number</span>,t:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:uint<span style="color: #66cc66;">&#123;</span>
		   <span style="color: #000000; font-weight: bold;">var</span> vx:<span style="color: #0066CC;">Number</span>=x<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">2.0</span>-<span style="color: #cc66cc;">1.0</span>; <span style="color: #000000; font-weight: bold;">var</span> vy:<span style="color: #0066CC;">Number</span>=-y<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">2.0</span>+<span style="color: #cc66cc;">1.0</span>;
		   <span style="color: #000000; font-weight: bold;">var</span> s:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0.4</span>;
		   <span style="color: #000000; font-weight: bold;">var</span> ox:<span style="color: #0066CC;">Number</span>=vx;var oy:<span style="color: #0066CC;">Number</span>=vy<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">1.25</span>;var oz:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0.0</span>;
		   <span style="color: #000000; font-weight: bold;">var</span> dx:<span style="color: #0066CC;">Number</span>=<span style="color: #66cc66;">&#40;</span>vx+<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span>t<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">0.3</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">64.0</span>;var dy:<span style="color: #0066CC;">Number</span>=vy<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">64.0</span>;var dz:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">1.0</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">64.0</span>;
		   <span style="color: #000000; font-weight: bold;">var</span> tt:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0.0</span>;
		   <span style="color: #000000; font-weight: bold;">var</span> g:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">1.0</span>;
		   <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>g<span style="color: #66cc66;">&amp;</span>gt;s<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&amp;</span>amp;<span style="color: #66cc66;">&amp;</span>amp;<span style="color: #66cc66;">&#40;</span>tt<span style="color: #66cc66;">&amp;</span>lt;<span style="color: #cc66cc;">375</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		         g=obj<span style="color: #66cc66;">&#40;</span>ox+dx<span style="color: #66cc66;">*</span>tt,oy+dy<span style="color: #66cc66;">*</span>tt,oz+dz<span style="color: #66cc66;">*</span>tt,t<span style="color: #66cc66;">&#41;</span>;
		         tt+=g<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">4</span>;
		   <span style="color: #66cc66;">&#125;</span>;
		   <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">color</span>:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0.0</span>;
		   <span style="color: #000000; font-weight: bold;">var</span> dxtt:<span style="color: #0066CC;">Number</span>=ox+dx<span style="color: #66cc66;">*</span>tt;var dytt:<span style="color: #0066CC;">Number</span>=oy+dy<span style="color: #66cc66;">*</span>tt;var dztt:<span style="color: #0066CC;">Number</span>=oz+dz<span style="color: #66cc66;">*</span>tt;
		   <span style="color: #000000; font-weight: bold;">var</span> objd:<span style="color: #0066CC;">Number</span>=obj<span style="color: #66cc66;">&#40;</span>dxtt,dytt,dztt,t<span style="color: #66cc66;">&#41;</span>;
		   <span style="color: #000000; font-weight: bold;">var</span> nx:<span style="color: #0066CC;">Number</span>=objd-obj<span style="color: #66cc66;">&#40;</span>dxtt+<span style="color: #cc66cc;">0.01</span>,dytt,dztt,t<span style="color: #66cc66;">&#41;</span>;
		   <span style="color: #000000; font-weight: bold;">var</span> ny:<span style="color: #0066CC;">Number</span>=objd-obj<span style="color: #66cc66;">&#40;</span>dxtt,dytt+<span style="color: #cc66cc;">0.01</span>,dztt,t<span style="color: #66cc66;">&#41;</span>;
		   <span style="color: #000000; font-weight: bold;">var</span> nz:<span style="color: #0066CC;">Number</span>=objd-obj<span style="color: #66cc66;">&#40;</span>dxtt,dytt,dztt+<span style="color: #cc66cc;">0.01</span>,t<span style="color: #66cc66;">&#41;</span>;
		   <span style="color: #000000; font-weight: bold;">var</span> d:<span style="color: #0066CC;">Number</span>=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sqrt</span><span style="color: #66cc66;">&#40;</span>nx<span style="color: #66cc66;">*</span>nx+ny<span style="color: #66cc66;">*</span>ny+nz<span style="color: #66cc66;">*</span>nz<span style="color: #66cc66;">&#41;</span>;ny=ny<span style="color: #66cc66;">/</span>d;nz=nz<span style="color: #66cc66;">/</span>d;
		   <span style="color: #0066CC;">color</span>+=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">max</span><span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">*</span>nz,<span style="color: #cc66cc;">0.0</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">max</span><span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">*</span>ny+<span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">*</span>nz,<span style="color: #cc66cc;">0.0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">0.5</span>;
		   <span style="color: #000000; font-weight: bold;">var</span> r:<span style="color: #0066CC;">Number</span>=<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">color</span>+<span style="color: #cc66cc;">0.1</span><span style="color: #66cc66;">*</span>tt<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">0.025</span><span style="color: #66cc66;">&#41;</span>;
		   <span style="color: #000000; font-weight: bold;">var</span> g:<span style="color: #0066CC;">Number</span>=<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">color</span>+<span style="color: #cc66cc;">0.2</span><span style="color: #66cc66;">*</span>tt<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">0.025</span><span style="color: #66cc66;">&#41;</span>;
		   <span style="color: #000000; font-weight: bold;">var</span> b:<span style="color: #0066CC;">Number</span>=<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">color</span>+<span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">*</span>tt<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">0.025</span><span style="color: #66cc66;">&#41;</span>;
		   <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">getRGB</span><span style="color: #66cc66;">&#40;</span>r,g,b<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">getRGB</span><span style="color: #66cc66;">&#40;</span>r:<span style="color: #0066CC;">Number</span>,g:<span style="color: #0066CC;">Number</span>,b:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:uint<span style="color: #66cc66;">&#123;</span>
		        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>r<span style="color: #66cc66;">&amp;</span>lt;<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> r=<span style="color: #cc66cc;">0</span>; <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>r<span style="color: #66cc66;">&amp;</span>gt;<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> r=<span style="color: #cc66cc;">1</span>;
		        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>g<span style="color: #66cc66;">&amp;</span>lt;<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> g=<span style="color: #cc66cc;">0</span>; <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>g<span style="color: #66cc66;">&amp;</span>gt;<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> g=<span style="color: #cc66cc;">1</span>;
		        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>b<span style="color: #66cc66;">&amp;</span>lt;<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> b=<span style="color: #cc66cc;">0</span>; <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>b<span style="color: #66cc66;">&amp;</span>gt;<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> b=<span style="color: #cc66cc;">1</span>;
			<span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>r<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&amp;</span>amp;<span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&amp;</span>lt;<span style="color: #66cc66;">&amp;</span>lt; <span style="color: #cc66cc;">16</span> <span style="color: #66cc66;">|</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>g<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&amp;</span>amp;<span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&amp;</span>lt;<span style="color: #66cc66;">&amp;</span>lt; <span style="color: #cc66cc;">8</span> <span style="color: #66cc66;">|</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>b<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&amp;</span>amp;<span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> draw<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> canvas.<span style="color: #006600;">bitmapData</span> == <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				canvas.<span style="color: #006600;">bitmapData</span> = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span> maxr , maxr , <span style="color: #000000; font-weight: bold;">false</span> , 0xffffff <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #000000; font-weight: bold;">var</span> t:BitmapData = canvas.<span style="color: #006600;">bitmapData</span>;
			<span style="color: #0066CC;">time</span>+=<span style="color: #cc66cc;">0.1</span>;
			t.<span style="color: #006600;">lock</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		        <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> x:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;x<span style="color: #66cc66;">&lt;</span>maxr;x++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		                <span style="color: #000000; font-weight: bold;">var</span> px:<span style="color: #0066CC;">Number</span>=x<span style="color: #66cc66;">/</span>maxr;
		                <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> y:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;y<span style="color: #66cc66;">&lt;</span>maxr;y++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		                        <span style="color: #000000; font-weight: bold;">var</span> py:<span style="color: #0066CC;">Number</span>=y<span style="color: #66cc66;">/</span>maxr;
		                        t.<span style="color: #006600;">setPixel</span><span style="color: #66cc66;">&#40;</span> x , y , <span style="color: #0066CC;">eval</span><span style="color: #66cc66;">&#40;</span>px,py,<span style="color: #0066CC;">time</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
		                <span style="color: #66cc66;">&#125;</span>
		        <span style="color: #66cc66;">&#125;</span>
		   t.<span style="color: #006600;">unlock</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>;
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><strong>Update:</strong> A quickly optimized version (nothing advanced really).</p>
<p>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_2" width="128" height="128">
      <param name="movie" value="/wp-content/uploads/flash/MetaTunnel-optim-1.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="/wp-content/uploads/flash/MetaTunnel-optim-1.swf" width="128" height="128">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
<br />
(You can switch quality in this version with key up or down).</p>
<p>Related posts:<ol>
<li><a href='http://blog.betabong.com/2009/04/17/metatunnel-with-pixel-bender/' rel='bookmark' title='MetaTunnel with Pixel Bender'>MetaTunnel with Pixel Bender</a></li>
<li><a href='http://blog.betabong.com/2008/09/26/weak-method-closure/' rel='bookmark' title='Weak Method Closure'>Weak Method Closure</a></li>
<li><a href='http://blog.betabong.com/2009/03/05/javascript-canvas-3d/' rel='bookmark' title='3D Point Cloud with Javascript and Canvas'>3D Point Cloud with Javascript and Canvas</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/04/13/metatunnel-1k-demo-as-vs-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GridFitType (&amp; animation)</title>
		<link>http://blog.betabong.com/2009/04/13/gridfittype-animation/</link>
		<comments>http://blog.betabong.com/2009/04/13/gridfittype-animation/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 23:02:58 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Rendering]]></category>
		<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=242</guid>
		<description><![CDATA[<p>GridFitType has a great impact on Text rendering:</p>
<p>Well not really much to say here:</p>
<ul>
<li><strong>NONE</strong> Good for animation and people who prefer Font appearance over readability</li>
<li><strong>SUBPIXEL</strong> Good compromise between readability (small sizes) and appearance</li>
<li><strong>PIXEL</strong> Pure nonsense</li></ul><p>&#8230; <a href="http://blog.betabong.com/2009/04/13/gridfittype-animation/" class="read_more">Read more</a></p>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>GridFitType has a great impact on Text rendering:</p>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_3" width="520" height="350">
      <param name="movie" value="/wp-content/uploads/flash/GridFitType/GridFitType.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="/wp-content/uploads/flash/GridFitType/GridFitType.swf" width="520" height="350">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>

<p>Well not really much to say here:</p>
<ul>
<li><strong>NONE</strong> Good for animation and people who prefer Font appearance over readability</li>
<li><strong>SUBPIXEL</strong> Good compromise between readability (small sizes) and appearance</li>
<li><strong>PIXEL</strong> Pure nonsense if you ask me</li>
</ul>
<p>What I really wonder though is: <strong>Why on earth can&#8217;t I adjust fractioned text sizes</strong> (aka float)??? In the IDE, yes you can. By actionscript, no you can&#8217;t. I don&#8217;t get it.. anybody knows why that is? And more importantly: is there some fancy workaround? (in the example I&#8217;m just scaling the text fields, but that&#8217;s not really a cool solution).</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/04/13/gridfittype-animation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>swffit &#8211; pro &amp; contra</title>
		<link>http://blog.betabong.com/2009/04/07/swffit-pro-con/</link>
		<comments>http://blog.betabong.com/2009/04/07/swffit-pro-con/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 12:04:52 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=232</guid>
		<description><![CDATA[<p><img class="alignright" title="swffit" src="http://swffit.millermedeiros.com/img/swffit_logo.gif" alt="" width="123" height="92" style="float: right;"/><a href="http://swffit.millermedeiros.com/">swffit</a> is a great little library that smartly resizes your flash movie depending on its content. It gives you <strong>native scrollbars for free</strong> whenever your content is longer than the browser window. Another strategy is to always have the flash&#8230; <a href="http://blog.betabong.com/2009/04/07/swffit-pro-con/" class="read_more">Read more</a></p>
No related posts.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" title="swffit" src="http://swffit.millermedeiros.com/img/swffit_logo.gif" alt="" width="123" height="92" style="float: right;"/><a href="http://swffit.millermedeiros.com/">swffit</a> is a great little library that smartly resizes your flash movie depending on its content. It gives you <strong>native scrollbars for free</strong> whenever your content is longer than the browser window. Another strategy is to always have the flash movie fill 100% the browser window and let Flash do the scrolling.</p>
<p>There are a lot of <strong>PRO</strong> for the <a href="http://swffit.millermedeiros.com/">swffit</a> way:</p>
<ul>
<li>It gives users the <strong>system scrollbar</strong>. Users are used to that, they know what it means, they know how to deal with it.</li>
<li><strong>Mouse wheels just work! </strong>It&#8217;s scrolling a standard browser window, no magic at all: great! (You have to use <a href="http://blog.pixelbreaker.com/flash/as30-mousewheel-on-mac-os-x/">this</a> otherwise)</li>
<li>It&#8217;s <strong>easy</strong> to implement.</li>
</ul>
<p>Still there is a <strong>CONTRA</strong> side:</p>
<ul>
<li>You&#8217;ll <strong>need javascript</strong> (well, that&#8217;s no biggy at all – as a matter of fact, you&#8217;re just pretty in the desert without javascript in todays websites)</li>
<li>You have no control over <strong>scrollbar design</strong> (neither a biggy – as another matter of fact I consider that a good thing anyway, but don&#8217;t tell the brand agency ;-)</li>
<li>It has <strong>performance disadvantages</strong>. Well that I consider a biggy! Because the movie will always be in its full height, it will do rerender for the entire area!! Imagine long page with animations here and there: Given Flash&#8217;s «not so fast» rendering engine, this can become a huge performance killer. Let me give you a quick&#8217;n'dirty example: <a href="/wp-content/uploads/flash/SWF_Size_Performance/performance-killer-percent.html">Full Height</a> compared to <a href="/wp-content/uploads/flash/SWF_Size_Performance/performance-killer-wsize.html">«Cropped» to Window Height</a> (just resize browser window to real small size to see the big difference).</li>
</ul>
<p><strong>Conclusion:</strong> I&#8217;m just glad I found one good reason to not declare my internal scrollbar like in <a href="http://www.betabong.com">www.betabong.com</a> as complete bullshit ;-)</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/04/07/swffit-pro-con/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Flash Debug Speed</title>
		<link>http://blog.betabong.com/2009/04/05/flash-debug-speed/</link>
		<comments>http://blog.betabong.com/2009/04/05/flash-debug-speed/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 00:49:46 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Frontend]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=225</guid>
		<description><![CDATA[<p>I did some speed tests today, comparing two string parsing methods. And I&#8217;ve made some very interesting discoveries: The execution speed between SWF compiled for debugging and those compiled without differs.</p>
<p>Ha! Okay, that&#8217;s not that much of news (even&#8230; <a href="http://blog.betabong.com/2009/04/05/flash-debug-speed/" class="read_more">Read more</a></p>
Related posts:<ol>
<li><a href='http://blog.betabong.com/2009/04/27/switch-flash-browser-plugin-mac/' rel='bookmark' title='Switch Flash Browser Plugin on Mac OS X'>Switch Flash Browser Plugin on Mac OS X</a></li>
<li><a href='http://blog.betabong.com/2008/08/22/flash-player-10-i-love-speed/' rel='bookmark' title='Flash Player 10 – I love speed'>Flash Player 10 – I love speed</a></li>
<li><a href='http://blog.betabong.com/2008/12/06/test-flex-throttled-simulate-download/' rel='bookmark' title='Test Flex/Flash throttled (aka Simulate Download)'>Test Flex/Flash throttled (aka Simulate Download)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I did some speed tests today, comparing two string parsing methods. And I&#8217;ve made some very interesting discoveries: The execution speed between SWF compiled for debugging and those compiled without differs.</p>
<p>Ha! Okay, that&#8217;s not that much of news (even for me). But what astonishes me is how much this speed gap can be, especially when it comes to massive data calculations. I somehow always had a somewhat 20 percent speed decrease in mind (I was just presuming, me dumb). But for a 3d particle test we&#8217;re talking factor 8!!</p>
<p>Now this made me curious&#8230; so I&#8217;ve tested with Debug and Release Player both debug and release SWFs:</p>
<p><strong>Debug Player running Debug SWF</strong></p>
<p><strong><a href="http://blog.betabong.com/wp-content/uploads/2009/04/picture-11.png" rel="lightbox[225]"><img class="alignnone size-full wp-image-226" title="Flash Debug in Debug" src="http://blog.betabong.com/wp-content/uploads/2009/04/picture-11.png" alt="Flash Debug in Debug" width="428" height="185" /></a></strong></p>
<p><strong>Debug Player running Release SWF</strong></p>
<p><strong><a href="http://blog.betabong.com/wp-content/uploads/2009/04/picture-9.png" rel="lightbox[225]"><img class="alignnone size-full wp-image-227" title="Release in Debug" src="http://blog.betabong.com/wp-content/uploads/2009/04/picture-9.png" alt="Release in Debug" width="428" height="185" /></a></strong></p>
<p><strong>Release Player running Debug SWF</strong></p>
<p><strong><a href="http://blog.betabong.com/wp-content/uploads/2009/04/picture-12.png" rel="lightbox[225]"><img class="alignnone size-full wp-image-228" title="Debug in Release" src="http://blog.betabong.com/wp-content/uploads/2009/04/picture-12.png" alt="Debug in Release" width="427" height="181" /></a></strong></p>
<p><strong>Release Player running Release SWF</strong></p>
<p><strong><a href="http://blog.betabong.com/wp-content/uploads/2009/04/picture-13.png" rel="lightbox[225]"><img class="alignnone size-full wp-image-229" title="Release in Release" src="http://blog.betabong.com/wp-content/uploads/2009/04/picture-13.png" alt="Release in Release" width="427" height="185" /></a></strong></p>
<p><strong>A few conclusions:</strong></p>
<ul>
<li><strong>Never release a SWF file with debug code</strong> (or otherwise said: put only stuff online from bin-release, never bin-debug). Though common users won&#8217;t notice the speed decrease, your friendly flash developers may, at least if you&#8217;re app is somewhat cpu intensive. And of course: debug SWF are much bigger in size (just in case you give a fuck about flash devs ;-)</li>
<li><strong>Speed tests should be played in the release player.</strong> Why? After all, I wouldn&#8217;t care if the relation would stay the same. Usually you just need to know how much faster one thing is compared to the other one, so that would do it. But unfortunately the ratio won&#8217;t always be the same. In the above example the ration is 3.66 for debug and 2.92 for release. And it can differ muuuuch more.</li>
</ul>
<p>The last one bugs me quite a bit. It&#8217;s just a pain in the ass to export a release build each time you wanna compare performance. And it also means you can&#8217;t do quick&#8217;n'dirty trace outputs for the time result (not a biggy if you&#8217;re testing within a Flex project though).</p>
<p>So here we go with <strong>two wishes for Adobe</strong>:</p>
<ul>
<li>Let us quickly test release builds within Flex Builder (a simple command would do it – I thought it might be «Run Testapp» (instead of «Debug Testapp»), but that just doesn&#8217;t bring up the Debugger (and same speed)</li>
<li>An option to turn off debugging mode in Debug Player!!! That would solve almost all problems, and we could also use our Plugin for normal browsing without performance penalties (is this why Youtube eats so much cpu here?</li>
</ul>
<p>Related posts:<ol>
<li><a href='http://blog.betabong.com/2009/04/27/switch-flash-browser-plugin-mac/' rel='bookmark' title='Switch Flash Browser Plugin on Mac OS X'>Switch Flash Browser Plugin on Mac OS X</a></li>
<li><a href='http://blog.betabong.com/2008/08/22/flash-player-10-i-love-speed/' rel='bookmark' title='Flash Player 10 – I love speed'>Flash Player 10 – I love speed</a></li>
<li><a href='http://blog.betabong.com/2008/12/06/test-flex-throttled-simulate-download/' rel='bookmark' title='Test Flex/Flash throttled (aka Simulate Download)'>Test Flex/Flash throttled (aka Simulate Download)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/04/05/flash-debug-speed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bug Hunting: Shadowed 3D and ScrollRect</title>
		<link>http://blog.betabong.com/2009/04/01/bug-hunting-shadowed-3d-and-scrollrect/</link>
		<comments>http://blog.betabong.com/2009/04/01/bug-hunting-shadowed-3d-and-scrollrect/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 16:02:05 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[Flash Player]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=217</guid>
		<description><![CDATA[<p>I don&#8217;t discover as many bugs nowadays as I&#8217;ve used to in the old days when I was beta testing for Macromedia. But it happened today, and I&#8217;ve just installed the newest Flash Player 10.0.22.87 to be sure.</p>
<p>It happens&#8230; <a href="http://blog.betabong.com/2009/04/01/bug-hunting-shadowed-3d-and-scrollrect/" class="read_more">Read more</a></p>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t discover as many bugs nowadays as I&#8217;ve used to in the old days when I was beta testing for Macromedia. But it happened today, and I&#8217;ve just installed the newest Flash Player 10.0.22.87 to be sure.</p>
<p>It happens to DisplayObjects A inside DisplayObjectContainers B inside DisplayObjectContainer C, when</p>
<ul>
<li>A was not initially visible (not inside initial scroll rect of C)</li>
<li>A is in 3D mode (I just change rotationY for that)</li>
<li>B is in «cached as Bitmap» (cacheAsBitmap would do, I go with DropShadowFilter in the example)</li>
<li>C&#8217;s scrollrect property is set, so A is shows up (well, it doesn&#8217;t – that&#8217;s the bug after all ;)</li>
</ul>
<p>Here the example:</p>
<div style="padding: 10px; background-color: #eee;"><object width="500" height="200" data="/wp-content/uploads/2009/04/bug-3d-shadow.swf" type="application/x-shockwave-flash"><param name="id" value="Bug-3D-Shadow" /><param name="align" value="middle" /><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="src" value="/wp-content/uploads/2009/04/bug-3d-shadow.swf" /><param name="name" value="Bug-3D-Shadow" /><param name="allowfullscreen" value="false" /></object></div>
<p><a href="http://blog.betabong.com/wp-content/uploads/2009/04/bug-3d-shadow.swf">bug-3d-shadow.swf</a><br />
<span id="more-217"></span><br />
And here the code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* Flash Bug - Flash Player 10.0.22.87
	disappearance when 3d's parent has shadow
	more info: betabong@gmail.com
*/</span>
&nbsp;
<span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">stage</span>.<span style="color: #0066CC;">scaleMode</span> = StageScaleMode.<span style="color: #006600;">NO_SCALE</span>;
<span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">stage</span>.<span style="color: #0066CC;">align</span> = StageAlign.<span style="color: #006600;">TOP_LEFT</span>;
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> scroller:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span> scroller <span style="color: #66cc66;">&#41;</span>;
scroller = <span style="color: #0066CC;">this</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> filter:DropShadowFilter = <span style="color: #000000; font-weight: bold;">new</span> DropShadowFilter<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">2</span> , <span style="color: #cc66cc;">90</span> , <span style="color: #cc66cc;">0</span> , <span style="color: #cc66cc;">0.5</span> , <span style="color: #cc66cc;">8</span> , <span style="color: #cc66cc;">8</span> , <span style="color: #cc66cc;">1</span> , <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> r:Sprite,rect:Sprite;
&nbsp;
<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">var</span> mode:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span> ; mode<span style="color: #66cc66;">&lt;</span>=<span style="color: #cc66cc;">1</span> ; mode++ <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;">0</span> ; i<span style="color: #66cc66;">&lt;</span><span style="color: #cc66cc;">3000</span> ; i+=<span style="color: #cc66cc;">100</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		r = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		r.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span> rect = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
		rect.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span> 0xff0000 <span style="color: #66cc66;">&#41;</span>;
		rect.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span> -<span style="color: #cc66cc;">40</span> , -<span style="color: #cc66cc;">40</span> , <span style="color: #cc66cc;">80</span> , <span style="color: #cc66cc;">80</span> <span style="color: #66cc66;">&#41;</span>;
		rect.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		rect.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">MOUSE_MOVE</span> , rotate <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">!</span>mode <span style="color: #66cc66;">&#41;</span> r.<span style="color: #006600;">cacheAsBitmap</span> = <span style="color: #000000; font-weight: bold;">true</span>; <span style="color: #808080; font-style: italic;">//r.filters = [ filter ];</span>
		r.<span style="color: #006600;">y</span> = i + <span style="color: #cc66cc;">100</span>;
		r.<span style="color: #006600;">x</span> = mode <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">150</span> + <span style="color: #cc66cc;">100</span>;
		addChild<span style="color: #66cc66;">&#40;</span> r <span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">ENTER_FRAME</span> , move <span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">scroll</span>:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>;
<span style="color: #000000; font-weight: bold;">function</span> move<span style="color: #66cc66;">&#40;</span> event:Event <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">scroll</span> += <span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">mouseY</span> - <span style="color: #cc66cc;">100</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">50</span>;
	scroller.<span style="color: #006600;">scrollRect</span> = <span style="color: #000000; font-weight: bold;">new</span> Rectangle<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> , <span style="color: #0066CC;">scroll</span> , <span style="color: #cc66cc;">500</span> , <span style="color: #cc66cc;">200</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> rotate<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:<span style="color: #66cc66;">*</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">rotationY</span>++;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><strong>Update:</strong> Now that: it took me about 20 min to file a bug in the Adobe Bug System (which is slow as hell anyway). And when I want to submit it, I get a message saying they&#8217;d be in maintenance. Well, buggy bug systems piss me off quite a bit.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/04/01/bug-hunting-shadowed-3d-and-scrollrect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Method Closure Owner (arguments.caller)</title>
		<link>http://blog.betabong.com/2009/03/26/method-closure-owner/</link>
		<comments>http://blog.betabong.com/2009/03/26/method-closure-owner/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 12:48:40 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=214</guid>
		<description><![CDATA[<p>In AS1 and AS2 we had access to arguments.caller within a function/method scope. This is not the case anymore in AS3. I wonder why. And I wonder why I can&#8217;t find a workaround, because everything should be there under the&#8230; <a href="http://blog.betabong.com/2009/03/26/method-closure-owner/" class="read_more">Read more</a></p>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>In AS1 and AS2 we had access to arguments.caller within a function/method scope. This is not the case anymore in AS3. I wonder why. And I wonder why I can&#8217;t find a workaround, because everything should be there under the hood:</p>
<blockquote><p><em>ActionScript</em> 3.0 enables a <em>method closure</em> to automatically remember its original object instance (from <a href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3_Flex/WS5b3ccc516d4fbf351e63e3d118a9b90204-7ff3.html">Adobe ActionScript 3.0 * Core language features</a>)</p></blockquote>
<p>Method Closure are quite a wonderful thing: They come in handy in many situations, especially when it comes to event listening and handling. And they stay kind of wonderful in terms of «hidden magic». Hidden magic is all that stuff never officially explained by Adobe. These things often are very core to the language (e.g. exact processing order, frame splitting, event handling), but Adobe decided – certainly for reasons – to only let us see and manipulate what common developers are to see and manipulate.</p>
<p>Still, I&#8217;d like to have to possibility to dig deeper if I want. If there is a MethodClosure Type, why is there no way to access its properties. After all it holds a reference to its owner. I may wanna know what the owner is! I admit that its not that there aren&#8217;t many obvious reasons why I would do so, but there are! For example:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> <span style="color: #0066CC;">width</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">caller</span> : <span style="color: #66cc66;">*</span> = MethodClosure<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">arguments</span>.<span style="color: #0066CC;">callee</span> <span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">owner</span>;
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> isChild<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">caller</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">return</span> widthValueForChild;
	<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">return</span> actualWidthValue;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>May be may be there is a way.. I&#8217;m not a hardcore byte array hacker, but if I find a solution (or explanation why o why), I&#8217;ll update this post.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/03/26/method-closure-owner/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>links for 2009-03-21</title>
		<link>http://blog.betabong.com/2009/03/22/links-for-2009-03-21/</link>
		<comments>http://blog.betabong.com/2009/03/22/links-for-2009-03-21/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 01:03:50 +0000</pubDate>
		<dc:creator>delicious</dc:creator>
				<category><![CDATA[]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/2009/03/22/links-for-2009-03-21/</guid>
		<description><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://www.behance.net/KrisSowersby/frame/57735">National on the Behance Network</a></div>
<div class="delicious-extended">Nice Antiqua Font by Kris Sowersby.</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/font%2Cinspiration">font,inspiration</a>)</div>
</li>
</ul>
<p>No related posts.</p>
No related posts.]]></description>
			<content:encoded><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://www.behance.net/KrisSowersby/frame/57735">National on the Behance Network</a></div>
<div class="delicious-extended">Nice Antiqua Font by Kris Sowersby.</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/font%2Cinspiration">font,inspiration</a>)</div>
</li>
</ul>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/03/22/links-for-2009-03-21/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>links for 2009-03-16</title>
		<link>http://blog.betabong.com/2009/03/17/links-for-2009-03-16/</link>
		<comments>http://blog.betabong.com/2009/03/17/links-for-2009-03-16/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 01:09:18 +0000</pubDate>
		<dc:creator>delicious</dc:creator>
				<category><![CDATA[]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/2009/03/17/links-for-2009-03-16/</guid>
		<description><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://www.kenjiroharigai.com/">Kenjiro Harigai</a></div>
<div class="delicious-extended">Partially interesting picture navigation.</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/inspiration">inspiration</a> <a href="http://delicious.com/sok/navigation">navigation</a>)</div>
</li>
<li>
<div class="delicious-link"><a href="http://www.re-reserved.com/">Reserved: Adventures of the Stardust Girl</a></div>
<div class="delicious-extended">Cool fashion website, playing with movie theme. Also well executed.</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/design">design</a> <a href="http://delicious.com/sok/webdesign">webdesign</a> <a href="http://delicious.com/sok/inspiration">inspiration</a> <a href="http://delicious.com/sok/fashion">fashion</a>)</div>
</li>
</ul>
<p>No related posts.</p>
No related posts.]]></description>
			<content:encoded><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://www.kenjiroharigai.com/">Kenjiro Harigai</a></div>
<div class="delicious-extended">Partially interesting picture navigation.</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/inspiration">inspiration</a> <a href="http://delicious.com/sok/navigation">navigation</a>)</div>
</li>
<li>
<div class="delicious-link"><a href="http://www.re-reserved.com/">Reserved: Adventures of the Stardust Girl</a></div>
<div class="delicious-extended">Cool fashion website, playing with movie theme. Also well executed.</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/design">design</a> <a href="http://delicious.com/sok/webdesign">webdesign</a> <a href="http://delicious.com/sok/inspiration">inspiration</a> <a href="http://delicious.com/sok/fashion">fashion</a>)</div>
</li>
</ul>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/03/17/links-for-2009-03-16/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3D Point Cloud with Javascript and Canvas</title>
		<link>http://blog.betabong.com/2009/03/05/javascript-canvas-3d/</link>
		<comments>http://blog.betabong.com/2009/03/05/javascript-canvas-3d/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 15:02:32 +0000</pubDate>
		<dc:creator>betabong</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/?p=208</guid>
		<description><![CDATA[<p>I was doing some stuff with 3D in Flash. And so I wondered wether sth similar might be achieved with pure HTML/Javascript. And yes, modern browsers (so not IE) can!</p>
<p>What I&#8217;ve done is this (a litte simplified):</p>
<ul>
<li>Migrated</li></ul><p>&#8230; <a href="http://blog.betabong.com/2009/03/05/javascript-canvas-3d/" class="read_more">Read more</a></p>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>I was doing some stuff with 3D in Flash. And so I wondered wether sth similar might be achieved with pure HTML/Javascript. And yes, modern browsers (so not IE) can!</p>
<p>What I&#8217;ve done is this (a litte simplified):</p>
<ul>
<li>Migrated my 3D engine I&#8217;ve written years ago from AS1 to Javascript</li>
<li>Extracted point cloud from Colada 3D object</li>
<li>Draw rectangles for every point to canvas</li>
</ul>
<p>And that&#8217;s how it looks:</p>
<p>    <canvas id="canvas" width="512" height="360"></canvas><br />
	<script src="http://www.betabong.com/work/lab/js/3d/3dEngine.js" type="text/javascript" charset="utf-8"></script><br />
	<script src="http://www.betabong.com/work/lab/js/3d/duck.js" type="text/javascript" charset="utf-8"></script></p>
<p>Should work on Safari, Firefox and Opera.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/03/05/javascript-canvas-3d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>links for 2009-03-04</title>
		<link>http://blog.betabong.com/2009/03/05/links-for-2009-03-04/</link>
		<comments>http://blog.betabong.com/2009/03/05/links-for-2009-03-04/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 01:04:51 +0000</pubDate>
		<dc:creator>delicious</dc:creator>
				<category><![CDATA[]]></category>

		<guid isPermaLink="false">http://blog.betabong.com/2009/03/05/links-for-2009-03-04/</guid>
		<description><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://www.macosxhints.com/article.php?story=20071025220746340">10.5: Easily change the location of your home directory</a></div>
<div class="delicious-extended">I&#39;ve been looking for that. Might be a way for my desktop/mobile sync problem (I&#39;m either long term desktop or long term mobile, nothing parallel).</div>
<div</li></ul><p>&#8230; <a href="http://blog.betabong.com/2009/03/05/links-for-2009-03-04/" class="read_more">Read more</a></p>
No related posts.]]></description>
			<content:encoded><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://www.macosxhints.com/article.php?story=20071025220746340">10.5: Easily change the location of your home directory</a></div>
<div class="delicious-extended">I&#39;ve been looking for that. Might be a way for my desktop/mobile sync problem (I&#39;m either long term desktop or long term mobile, nothing parallel).</div>
<div class="delicious-tags">(tags: <a href="http://delicious.com/sok/sync">sync</a> <a href="http://delicious.com/sok/mac">mac</a> <a href="http://delicious.com/sok/os">os</a> <a href="http://delicious.com/sok/x">x</a>)</div>
</li>
</ul>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.betabong.com/2009/03/05/links-for-2009-03-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: blog.betabong.com @ 2012-05-19 11:30:53 -->
