<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.1" -->
<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/"
	>

<channel>
	<title>pixelbreaker</title>
	<link>http://blog.pixelbreaker.com</link>
	<description>flash stuff...</description>
	<pubDate>Tue, 29 Apr 2008 08:40:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>
	<language>en</language>
			<item>
		<title>AS3.0 MouseWheel on Mac OS X</title>
		<link>http://blog.pixelbreaker.com/flash/as30-mousewheel-on-mac-os-x/</link>
		<comments>http://blog.pixelbreaker.com/flash/as30-mousewheel-on-mac-os-x/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 23:34:56 +0000</pubDate>
		<dc:creator>gabriel</dc:creator>
		
		<category><![CDATA[Mac]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/flash/as30-mousewheel-on-mac-os-x/</guid>
		<description><![CDATA[I've finally found the time to port my SWFObject add-on SWFMacMouseWheel (catchy I know) to ActionScript 3.0 and SWFObject 2.0
There's now two examples in the zip, one for use with SWFObject 1.5, and a totally re-written version for use with SWFObject 2.0 (formerly SWFFix)
All you have to do in your main application class (or document [...]]]></description>
			<content:encoded><![CDATA[<p>I've finally found the time to port my SWFObject add-on SWFMacMouseWheel (catchy I know) to ActionScript 3.0 and SWFObject 2.0</p>
<p>There's now two examples in the zip, one for use with <a href="http://blog.deconcept.com/swfobject/">SWFObject 1.5</a>, and a totally re-written version for use with <a href="http://code.google.com/p/swfobject/">SWFObject 2.0</a> (formerly SWFFix)</p>
<p>All you have to do in your main application class (or document class) is</p>
<div class="igBar"><span id="lactionscript-3"><a href="#" onclick="javascript:showPlainTxt('actionscript-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite" style="background-color: #333; color: #AAA;"><span class="langName">Actionscript:</span>
<div id="actionscript-3">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cdfbfe;">import</span> com.<span style="color: #fff9a2;">pixelbreaker</span>.<span style="color: #fff9a2;">ui</span>.<span style="color: #fff9a2;">osx</span>.<span style="color: #fff9a2;">MacMouseWheel</span>;</div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">MacMouseWheel.<span style="color: #fff9a2;">setup</span><span style="color: #f7f99d;">&#40;</span> <span style="color: #cdfbfe;">stage</span> <span style="color: #f7f99d;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You can then add listeners to TextFields, Sprites etc etc as you normally would any other MouseEvent.</p>
<p>Example JavaScript to be used with the dynamic embed method</p>
<div class="igBar"><span id="ljavascript-4"><a href="#" onclick="javascript:showPlainTxt('javascript-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite" style="background-color: #333; color: #AAA;"><span class="langName">JavaScript:</span>
<div id="javascript-4">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cdfbfe; font-weight: bold;">var</span> vars = <span style="color: #f7f99d;">&#123;</span><span style="color: #f7f99d;">&#125;</span>;</div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cdfbfe; font-weight: bold;">var</span> params = <span style="color: #f7f99d;">&#123;</span> scale:<span style="color: #04ffa6;">'noScale'</span>, salign:<span style="color: #04ffa6;">'lt'</span>, menu:<span style="color: #04ffa6;">'false'</span> <span style="color: #f7f99d;">&#125;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cdfbfe; font-weight: bold;">var</span> attributes = <span style="color: #f7f99d;">&#123;</span> id:<span style="color: #04ffa6;">'testObject'</span>, <span style="color: #cdfbfe;">name</span>:<span style="color: #04ffa6;">'testObject'</span> <span style="color: #f7f99d;">&#125;</span>; <span style="color: #668ed2; font-style: italic;">// give an id to the flash object</span></div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">swfobject.<span style="color: #fff9a2;">embedSWF</span><span style="color: #f7f99d;">&#40;</span><span style="color: #04ffa6;">"test_as3.swf"</span>, <span style="color: #04ffa6;">"flashContent"</span>, <span style="color: #04ffa6;">"100%"</span>, <span style="color: #04ffa6;">"100%"</span>, <span style="color: #04ffa6;">"9.0.0"</span>, <span style="color: #04ffa6;">"js/expressInstall.swf"</span>, vars, params, attributes <span style="color: #f7f99d;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">swfmacmousewheel.<span style="color: #fff9a2;">registerObject</span><span style="color: #f7f99d;">&#40;</span>attributes.<span style="color: #fff9a2;">id</span><span style="color: #f7f99d;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>I have updated the SWFObject 2.0 version to be more compact, and it also falls inline with the code style of SWFObject2.0. see <em>swfmacmousewheel_src.js</em> for the uncompressed version, deploy <em>swfmacmousewheel2.js</em> on your site.</p>
<p>Download <a href="http://blog.pixelbreaker.com/downloads/swfmacmousewheel_as3.zip">source and demo here</a> or view the <a href="http://blog.pixelbreaker.com/downloads/swfmacmousewheelas3demo/index_as3.html">demo online</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/flash/as30-mousewheel-on-mac-os-x/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AS3.0 Memory monitoring</title>
		<link>http://blog.pixelbreaker.com/flash/as30-memory-monitoring/</link>
		<comments>http://blog.pixelbreaker.com/flash/as30-memory-monitoring/#comments</comments>
		<pubDate>Fri, 09 Nov 2007 10:43:26 +0000</pubDate>
		<dc:creator>gabriel</dc:creator>
		
		<category><![CDATA[Tips]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/flash/as30-memory-monitoring/</guid>
		<description><![CDATA[I just came across the property System.totalMemory. It's very useful, especially for the engine I am currently working on, and dealing with AS3 garbage collection.
It returns the memory currently being used by the Flash Player.  It's in bytes so it pays to clean it up slightly.
PLAIN TEXT
Actionscript:




var mem:String = Number&#40; System.totalMemory / 1024 / [...]]]></description>
			<content:encoded><![CDATA[<p>I just came across the property <em>System.totalMemory</em>. It's very useful, especially for the engine I am currently working on, and dealing with AS3 garbage collection.</p>
<p>It returns the memory currently being used by the Flash Player.  It's in bytes so it pays to clean it up slightly.</p>
<div class="igBar"><span id="lactionscript-6"><a href="#" onclick="javascript:showPlainTxt('actionscript-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite" style="background-color: #333; color: #AAA;"><span class="langName">Actionscript:</span>
<div id="actionscript-6">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cdfbfe; font-weight: bold;">var</span> mem:<span style="color: #cdfbfe;">String</span> = <span style="color: #cdfbfe;">Number</span><span style="color: #f7f99d;">&#40;</span> <span style="color: #cdfbfe;">System</span>.<span style="color: #fff9a2;">totalMemory</span> / <span style="color: #ffe683;color:#800000;">1024</span> / <span style="color: #ffe683;color:#800000;">1024</span> <span style="color: #f7f99d;">&#41;</span>.<span style="color: #fff9a2;">toFixed</span><span style="color: #f7f99d;">&#40;</span> <span style="color: #ffe683;color:#800000;">2</span> <span style="color: #f7f99d;">&#41;</span> + <span style="color: #04ffa6;">'Mb'</span>;</div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cdfbfe;">trace</span><span style="color: #f7f99d;">&#40;</span> mem <span style="color: #f7f99d;">&#41;</span>; <span style="color: #668ed2; font-style: italic;">// eg traces &quot;24.94Mb&quot; </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>It seems this takes account of all instances of the flash player. For example, I have a logger/debug panel running in the sidebar of firefox, built in flex. As soon as I open this and it's initialised, it uses an extra 5 - 10mb of ram. So be warned, if you see a massive increase in memory usage, check you don't have loads of sites open with ad banners or other flash based stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/flash/as30-memory-monitoring/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Back from Flash on the Beach</title>
		<link>http://blog.pixelbreaker.com/flash/back-from-flash-on-the-beach/</link>
		<comments>http://blog.pixelbreaker.com/flash/back-from-flash-on-the-beach/#comments</comments>
		<pubDate>Thu, 08 Nov 2007 21:21:40 +0000</pubDate>
		<dc:creator>gabriel</dc:creator>
		
		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/uncategorized/back-from-flash-on-the-beach/</guid>
		<description><![CDATA[
I got back from Brighton yesterday, exhausted after 3 days of excellent sessions and some heavy drinking sessions too!
The high points for me were Mario Klingemann's  "2D or not 2D, that is the question" talk about working with BitmapData. He showed how to make a "Magic Wand" tool a la photoshop. His process was [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm1.static.flickr.com/144/318169351_90e15f3a2e.jpg" title="photo by BIT-101" alt="photo by BIT-101" height="375" width="500" /><br />
I got back from Brighton yesterday, exhausted after 3 days of excellent sessions and some heavy drinking sessions too!</p>
<p>The high points for me were Mario Klingemann's  "2D or not 2D, that is the question" talk about working with BitmapData. He showed how to make a "Magic Wand" tool a la photoshop. His process was impressive to say the least, and I'm very interested in playing with the paletteMap method of the BitmapData class.</p>
<p>The session from <a href="http://blog.andre-michelle.com/">André Michelle</a> was amazing, he demoed his <a href="http://code.google.com/p/popforge/">PopForge</a> sound synthesis engine. Generating sound entirely within flash at run-time. See the video below, this is all generated and manipulated in flash. It's simply amazing, I can't wait to get some time (after this post) to start messing around with sound in flash.</p>
<p> <a href="http://blog.pixelbreaker.com/flash/back-from-flash-on-the-beach/#more-61" class="more-link">(more...)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/flash/back-from-flash-on-the-beach/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PolarClock on OS X Leopard</title>
		<link>http://blog.pixelbreaker.com/flash/polarclock-on-os-x-leopard/</link>
		<comments>http://blog.pixelbreaker.com/flash/polarclock-on-os-x-leopard/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 15:13:24 +0000</pubDate>
		<dc:creator>gabriel</dc:creator>
		
		<category><![CDATA[Screensaver]]></category>

		<category><![CDATA[Mac]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/flash/polarclock-on-os-x-leopard/</guid>
		<description><![CDATA[I've found a bug in screentime, the software used to pack up PolarClock as a screensaver. When run on Leopard, after the screensaver exits back to the desktop, the Function keys and any shortcuts to the Dashboard or exposé don't work. I have contacted screentime about this issue, and will post a fix a.s.a.p
]]></description>
			<content:encoded><![CDATA[<p>I've found a bug in screentime, the software used to pack up PolarClock as a screensaver. When run on Leopard, after the screensaver exits back to the desktop, the Function keys and any shortcuts to the Dashboard or exposé don't work. I have contacted screentime about this issue, and will post a fix a.s.a.p</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/flash/polarclock-on-os-x-leopard/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AS3.0 JIT vs. Interpreted</title>
		<link>http://blog.pixelbreaker.com/flash/as30-jit-vs-interpreted/</link>
		<comments>http://blog.pixelbreaker.com/flash/as30-jit-vs-interpreted/#comments</comments>
		<pubDate>Sun, 09 Sep 2007 12:10:54 +0000</pubDate>
		<dc:creator>gabriel</dc:creator>
		
		<category><![CDATA[Tips]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/flash/as30-jit-vs-interpreted/</guid>
		<description><![CDATA[I've been developing an application recently that requires large numbers of classes to be initialised as soon as the application is loaded. It's an isometric display engine, a la "Sim City", with a world map of 800 x 600 tiles, and multiple layers ( terrain, objects, transport networks etc)  there's potential for over 100,000 [...]]]></description>
			<content:encoded><![CDATA[<p>I've been developing an application recently that requires large numbers of classes to be initialised as soon as the application is loaded. It's an isometric display engine, a la "Sim City", with a world map of 800 x 600 tiles, and multiple layers ( terrain, objects, transport networks etc)  there's potential for over 100,000 instances!!!</p>
<p>I found <a href="http://www.onflex.org/ACDS/AS3TuningInsideAVM2JIT.pdf">ActionScript 3.0 and AVM2: Performance Tuning</a> by Gary Grossman, which covers many aspects of how AVM2 is different from AVM1. The part I was interested in was about $init and $cinit (class constructor) functions being interpreted and everything else being JIT.</p>
<p>The initial setup of the engine runs over a timed loop (to stop script timeouts), and this was typically taking 20 to 30 seconds. After reading the above PDF, it became clear that class constructors are interpreted, not JIT compiled, so all I had to do was move the code out of the constructor, into an init() function, and call if after the constructor, this shaved a huge amount of time off the initial build of the landscape.</p>
<p>Some initial tests, with a for loop running from 0 to 10000 showed that in the constructor it took about 350ms, and called via another method, it took only 240ms. It is not always faster, but 90% of the time it's faster.</p>
<p> <a href="http://blog.pixelbreaker.com/flash/as30-jit-vs-interpreted/#more-58" class="more-link">(more...)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/flash/as30-jit-vs-interpreted/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AS3.0 Better Singletons</title>
		<link>http://blog.pixelbreaker.com/flash/as30-better-singletons/</link>
		<comments>http://blog.pixelbreaker.com/flash/as30-better-singletons/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 20:49:10 +0000</pubDate>
		<dc:creator>gabriel</dc:creator>
		
		<category><![CDATA[Tips]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/flash/as30-better-singletons/</guid>
		<description><![CDATA[I've found a better more robust way of enforcing singletons in AS3.0
PLAIN TEXT
Actionscript:




package


&#123;


&#160; &#160; public class Singleton


&#160; &#160; &#123;


&#160; &#160; &#160; &#160; public static var instance:Singleton;


&#160;


&#160; &#160; &#160; &#160; public static function getInstance&#40;&#41;:Singleton


&#160; &#160; &#160; &#160; &#123;


&#160; &#160; &#160; &#160; &#160; &#160; if&#40; instance == null &#41; instance = new Singleton&#40; new SingletonEnforcer&#40;&#41; &#41;;


&#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>I've found a better more robust way of enforcing singletons in AS3.0</p>
<div class="igBar"><span id="lactionscript-8"><a href="#" onclick="javascript:showPlainTxt('actionscript-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite" style="background-color: #333; color: #AAA;"><span class="langName">Actionscript:</span>
<div id="actionscript-8">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package</div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #f7f99d;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #cdfbfe;">public</span> <span style="color: #cdfbfe; font-weight: bold;">class</span> Singleton</div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #f7f99d;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #cdfbfe;">public</span> <span style="color: #cdfbfe;">static</span> <span style="color: #cdfbfe; font-weight: bold;">var</span> instance:Singleton;</div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #cdfbfe;">public</span> <span style="color: #cdfbfe;">static</span> <span style="color: #cdfbfe; font-weight: bold;">function</span> getInstance<span style="color: #f7f99d;">&#40;</span><span style="color: #f7f99d;">&#41;</span>:Singleton</div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #f7f99d;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #cdfbfe;">if</span><span style="color: #f7f99d;">&#40;</span> instance == <span style="color: #cdfbfe; font-weight: bold;">null</span> <span style="color: #f7f99d;">&#41;</span> instance = <span style="color: #cdfbfe; font-weight: bold;">new</span> Singleton<span style="color: #f7f99d;">&#40;</span> <span style="color: #cdfbfe; font-weight: bold;">new</span> SingletonEnforcer<span style="color: #f7f99d;">&#40;</span><span style="color: #f7f99d;">&#41;</span> <span style="color: #f7f99d;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #cdfbfe;">return</span> instance;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #f7f99d;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #cdfbfe;">public</span> <span style="color: #cdfbfe; font-weight: bold;">function</span> Singleton<span style="color: #f7f99d;">&#40;</span> pvt:SingletonEnforcer <span style="color: #f7f99d;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #f7f99d;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #668ed2; font-style: italic;">// init class</span></div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #f7f99d;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #f7f99d;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #f7f99d;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">internal <span style="color: #cdfbfe; font-weight: bold;">class</span> SingletonEnforcer<span style="color: #f7f99d;">&#123;</span><span style="color: #f7f99d;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
<strong>Note:</strong> The class "SingletonEnforcer" is actually placed within the same .as file as the Singleton class, but placed outside the package{} parenthesis, therefore, the class "SingletonEnforcer" can only be accessed from within this .as file, so if the Singleton's constructor is called from anywhere else, you'll get an error.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/flash/as30-better-singletons/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AS3.0 Reversed for loop</title>
		<link>http://blog.pixelbreaker.com/flash/as30-reversed-for-loop/</link>
		<comments>http://blog.pixelbreaker.com/flash/as30-reversed-for-loop/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 11:18:58 +0000</pubDate>
		<dc:creator>gabriel</dc:creator>
		
		<category><![CDATA[Tips]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/flash/as3-tip-reversed-for-loops/</guid>
		<description><![CDATA[Today I came across an easy mistake to make when new to AS3.
I set up a for loop, to count backwards through an Array. But for some strange reason the loop was never terminating! It was simple, here's the original code
PLAIN TEXT
Actionscript:




var i:uint;


for&#40; i=arr.length-1; i&#62;=0; i-- &#41;


&#123;


&#125; 






The mistake was simple, I had set i [...]]]></description>
			<content:encoded><![CDATA[<p>Today I came across an easy mistake to make when new to AS3.</p>
<p>I set up a for loop, to count backwards through an Array. But for some strange reason the loop was never terminating! It was simple, here's the original code</p>
<div class="igBar"><span id="lactionscript-10"><a href="#" onclick="javascript:showPlainTxt('actionscript-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite" style="background-color: #333; color: #AAA;"><span class="langName">Actionscript:</span>
<div id="actionscript-10">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cdfbfe; font-weight: bold;">var</span> i:uint;</div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cdfbfe;">for</span><span style="color: #f7f99d;">&#40;</span> i=arr.<span style="color: #fff9a2;">length</span>-<span style="color: #ffe683;color:#800000;">1</span>; i&gt;=<span style="color: #ffe683;color:#800000;">0</span>; i-- <span style="color: #f7f99d;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #f7f99d;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#CFCFCF;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #f7f99d;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The mistake was simple, I had set i as a <em>uint</em>, so it could never go below 0, so just had to make i an <em>int</em>. It sounds stupid once you realise it, but it wasted enough of my time!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/flash/as30-reversed-for-loop/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Looping within a range</title>
		<link>http://blog.pixelbreaker.com/flash/looping-within-a-range/</link>
		<comments>http://blog.pixelbreaker.com/flash/looping-within-a-range/#comments</comments>
		<pubDate>Thu, 26 Jul 2007 15:32:28 +0000</pubDate>
		<dc:creator>gabriel</dc:creator>
		
		<category><![CDATA[Tips]]></category>

		<category><![CDATA[ActionScript 2.0]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/flash/looping-within-a-range/</guid>
		<description><![CDATA[Something I have to do very often is looping a number within a range. This could be for a carousel navigation, a rotating banner or image slideshow, etc. The concept is simple, have a range, say 1 - 20, and simply call next() / previous() on it and return the new number, if it goes [...]]]></description>
			<content:encoded><![CDATA[<p>Something I have to do very often is looping a number within a range. This could be for a carousel navigation, a rotating banner or image slideshow, etc. The concept is simple, have a range, say 1 - 20, and simply call next() / previous() on it and return the new number, if it goes above 20, return to 1, if below 1, return to 20.<br />
 <a href="http://blog.pixelbreaker.com/flash/looping-within-a-range/#more-55" class="more-link">(more...)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/flash/looping-within-a-range/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PolarClock Dashboard Widget</title>
		<link>http://blog.pixelbreaker.com/flash/polarclock-dashboard-widget/</link>
		<comments>http://blog.pixelbreaker.com/flash/polarclock-dashboard-widget/#comments</comments>
		<pubDate>Thu, 19 Jul 2007 18:24:23 +0000</pubDate>
		<dc:creator>gabriel</dc:creator>
		
		<category><![CDATA[Mac]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/flash/polarclock-dashboard-widget/</guid>
		<description><![CDATA[
A lot of people had been asking for this as a widget. So i've put together this version for the OS X Dashboard. The options are limited to language selection only.
Download:
[zip] PolarClock OSX Widget 356Kb
]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.pixelbreaker.com/uploads/2007/07/widget.jpg" alt="widget.jpg" /></p>
<p>A lot of people had been asking for this as a widget. So i've put together this version for the OS X Dashboard. The options are limited to language selection only.</p>
<p>Download:<br />
[zip] <strong><a href="/downloads/polarclock/PolarClock3_osx_wdgt.zip">PolarClock OSX Widget</a> </strong>356Kb</p>
<p> <a href="http://blog.pixelbreaker.com/flash/polarclock-dashboard-widget/#more-52" class="more-link">(more...)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/flash/polarclock-dashboard-widget/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New role at Digit!</title>
		<link>http://blog.pixelbreaker.com/work/new-role-at-digit/</link>
		<comments>http://blog.pixelbreaker.com/work/new-role-at-digit/#comments</comments>
		<pubDate>Tue, 17 Jul 2007 16:52:11 +0000</pubDate>
		<dc:creator>gabriel</dc:creator>
		
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/work/new-role-at-digit/</guid>
		<description><![CDATA[After being freelance for the last 8 months, which has been pretty chaotic, I've accepted the position of "Senior Creative Technologist" at digit, a long established London agency. 
It's going to be a really interesting role for me, where I'll carry on working with the Flash Platform (Flash, Flex, and hopefully some AIR apps), but [...]]]></description>
			<content:encoded><![CDATA[<p>After being freelance for the last 8 months, which has been pretty chaotic, I've accepted the position of "Senior Creative Technologist" at <a href="http://www.digitlondon.com/" target="_blank">digit</a>, a long established London agency. </p>
<p>It's going to be a really interesting role for me, where I'll carry on working with the Flash Platform (Flash, Flex, and hopefully some AIR apps), but also be involved in developing and designing physical interaction pieces using many technologies that I'll be new to. Like Java, C#, mobile phone development, touch screens, motion sensors, whatever goes really. It's going to be a great opportunity to broaden my knowledge.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/work/new-role-at-digit/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
