<?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>pixelbreaker &#187; ActionScript 2.0</title>
	<atom:link href="http://blog.pixelbreaker.com/category/actionscript-2-0/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.pixelbreaker.com</link>
	<description></description>
	<lastBuildDate>Wed, 11 Jan 2012 17:01:08 +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>Looping within a range</title>
		<link>http://blog.pixelbreaker.com/actionscript-2-0/looping-within-a-range</link>
		<comments>http://blog.pixelbreaker.com/actionscript-2-0/looping-within-a-range#comments</comments>
		<pubDate>Thu, 26 Jul 2007 15:32:28 +0000</pubDate>
		<dc:creator>gabes</dc:creator>
				<category><![CDATA[ActionScript 2.0]]></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 &#8211; 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 &#8211; 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 />
<span id="more-55"></span><br />
The AS2.0 class is as follows<br />
[as]<br />
class com.pixelbreaker.number.LoopRange<br />
{<br />
	public var min:Number;<br />
	public var max:Number;</p>
<p>	private var _current:Number;</p>
<p>	function LoopRange( min:Number, max:Number, start:Number )<br />
	{<br />
		this.min = min;<br />
		this.max = max;<br />
		_current = start || min;<br />
	}</p>
<p>	public function next():Number<br />
	{<br />
		_current = _current+1 <= max? _current+1 : min;<br />
		return _current;<br />
	}</p>
<p>	public function previous():Number<br />
	{<br />
		_current = _current-1 >= min? _current-1 : max;<br />
		return _current;<br />
	}</p>
<p>	public function set current( value:Number ):Void<br />
	{<br />
		if( value >= min &#038;&#038; value <= max ) _current = value;<br />
		else throw new GenericError( &#8216;number &#8216; + value + &#8216; is out of range [ ' + min + ', ' + max + ' ]&#8216; );<br />
	}</p>
<p>	public function get current():Number<br />
	{<br />
		return _current;<br />
	}<br />
}<br />
[/as]</p>
<p>To implement this on an array you would do the following</p>
<p>[as]<br />
import com.pixelbreaker.number.LoopRange;</p>
<p>var slideShowImages:Array = [];<br />
for( var i:Number = 0; i<xmlNode.childNodes.length; i++ )<br />
{<br />
    slideShowImages.push( xmlNode.childNodes[ i ].attributes.src );<br />
}</p>
<p>var loopRange:LoopRange = new LoopRange( 0, slideShowImages.length-1 );</p>
<p>// to load the next image:<br />
myMovieClip.loadMovie( slideShowImages[ loopRange.next() ] );</p>
<p>[/as]</p>
<p>I&#8217;ll add the AS3 class soon, it&#8217;s barely any different</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/actionscript-2-0/looping-within-a-range/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Polar Clock v2</title>
		<link>http://blog.pixelbreaker.com/play/polar-clock-v2</link>
		<comments>http://blog.pixelbreaker.com/play/polar-clock-v2#comments</comments>
		<pubDate>Sat, 14 Apr 2007 20:22:22 +0000</pubDate>
		<dc:creator>gabes</dc:creator>
				<category><![CDATA[ActionScript 2.0]]></category>
		<category><![CDATA[Play]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/uncategorized/polar-clock-v2/</guid>
		<description><![CDATA[Version 3 is now available here I&#8217;ve made a few changes to my polar clock to make it clearer to read, and now there&#8217;s also a PC installer]]></description>
			<content:encoded><![CDATA[<p>Version 3 is now <a href="http://blog.pixelbreaker.com/polarclock/">available here</a><br />
I&#8217;ve made a few changes to my polar clock to make it clearer to read, and now there&#8217;s also a PC installer</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/play/polar-clock-v2/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Polar Clock Screensaver</title>
		<link>http://blog.pixelbreaker.com/play/polar-clock</link>
		<comments>http://blog.pixelbreaker.com/play/polar-clock#comments</comments>
		<pubDate>Sun, 04 Feb 2007 12:01:43 +0000</pubDate>
		<dc:creator>gabes</dc:creator>
				<category><![CDATA[ActionScript 2.0]]></category>
		<category><![CDATA[Play]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/uncategorized/polar-clock/</guid>
		<description><![CDATA[UPDATE: Version 3 is now available here View Polar Clock Download Screensaver for Mac OS X only. I&#8217;ve just put this together as a bit of a test of some drawing API extensions I wrote a while ago. All the shapes are drawn with code, corner rounding curves are achieved using the &#8216;capStyle&#8217; argument when [...]]]></description>
			<content:encoded><![CDATA[<p><a href="/upload/polarclock/polarclock.html"><img src="http://blog.pixelbreaker.com/wp-content/launch.jpg" alt="launch.jpg" /></a></p>
<p>UPDATE:<br />
Version 3 is now <a href="http://blog.pixelbreaker.com/polarclock/">available here</a></p>
<p><strike>View Polar Clock</strike></p>
<p><strike>Download Screensaver</strike> for Mac OS X only.</p>
<p>I&#8217;ve just put this together as a bit of a test of some drawing API extensions I wrote a while ago. All the shapes are drawn with code, corner rounding curves are achieved using the &#8216;capStyle&#8217; argument when setting the lineStyle, easy as that! The colour of each ring is based on an HSL colourwheel.<br />
<a href="http://blog.pixelbreaker.com/polarclock/"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/play/polar-clock/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kernel Debugger</title>
		<link>http://blog.pixelbreaker.com/library/kernel-debugger</link>
		<comments>http://blog.pixelbreaker.com/library/kernel-debugger#comments</comments>
		<pubDate>Fri, 26 Jan 2007 10:28:06 +0000</pubDate>
		<dc:creator>gabes</dc:creator>
				<category><![CDATA[ActionScript 2.0]]></category>
		<category><![CDATA[Library]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/flash/kernel-debugger/</guid>
		<description><![CDATA[I&#8217;ve been using this for a long time now, it&#8217;s a debugger that runs in another SWF and is passed trace statements via my Debug class, with different levels or detail, info, warning, event, classinfo, error etc. It also has a runtime monitor graph at the bottom, the yellow line showing the current framerate, and [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.pixelbreaker.com/upload/debugger.jpg" alt="debugger" height="395" width="347" /><br />
I&#8217;ve been using this for a long time now, it&#8217;s a debugger that runs in another SWF and is passed trace statements via my Debug class, with different levels or detail, info, warning, event, classinfo, error etc. It also has a runtime monitor graph at the bottom, the yellow line showing the current framerate, and the blue line showing the time it takes to execute all threads currently running in the Kernel class. The Kernel is basically a single onEnterFrame on a MovieClip in the _root, which runs through an array of threads, I simply have a getTimer() at either side of the thread execution and time it, this is a great way to view code-weight, especially when developing games or persistent enviornments such as physical engines.</p>
<p>I will make a public release of the Kernel, Thread and ThreadGroup classes soon, which will also include the debugger.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/library/kernel-debugger/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2D Physics API</title>
		<link>http://blog.pixelbreaker.com/open-source/2d-physics-api</link>
		<comments>http://blog.pixelbreaker.com/open-source/2d-physics-api#comments</comments>
		<pubDate>Thu, 25 Jan 2007 20:36:55 +0000</pubDate>
		<dc:creator>gabes</dc:creator>
				<category><![CDATA[ActionScript 2.0]]></category>
		<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/uncategorized/2d-physics-api/</guid>
		<description><![CDATA[I&#8217;ve recently been doing some games work that required some pretty full on physics, after battling with vectors and collision reflection on wheels and other objects, I ditched what I had done and am now working with FlaDE (Flash Dynamics Engine) an AS 2.0 GPL Licensed API. It&#8217;s written by Alec Cove, and is very [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been doing some games work that required some pretty full on physics, after battling with vectors and collision reflection on wheels and other objects, I ditched what I had done and am now working with <a href="http://www.cove.org/flade/" target="_blank">FlaDE</a> (Flash Dynamics Engine) an AS 2.0 GPL Licensed API. It&#8217;s written by Alec Cove, and is very easy to use. It never went to final release, and he has now moved on to <a href="http://www.cove.org/ape/" target="_blank">APE</a> (ActionScript Physics Engine) which is written instead in AS 3.0 and is again GPL Licensed.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/open-source/2d-physics-api/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A better implementation of FlashVars</title>
		<link>http://blog.pixelbreaker.com/actionscript-2-0/datatypedflashvars</link>
		<comments>http://blog.pixelbreaker.com/actionscript-2-0/datatypedflashvars#comments</comments>
		<pubDate>Fri, 17 Nov 2006 00:38:32 +0000</pubDate>
		<dc:creator>gabes</dc:creator>
				<category><![CDATA[ActionScript 2.0]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/flash/datatypedflashvars/</guid>
		<description><![CDATA[[slug]DataTypedFlashVars[/slug]Patrick Mineault has an interesting approach to using flashVars and getting data typed objects passed into Flash. A sane approach to FlashVars]]></description>
			<content:encoded><![CDATA[<p>[slug]DataTypedFlashVars[/slug]Patrick Mineault has an interesting approach to using flashVars and getting data typed objects passed into Flash.</p>
<p><a href="http://www.5etdemi.com/blog/archives/2006/11/a-sane-approach-to-flashvars/" target="_blank">A sane approach to FlashVars</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/actionscript-2-0/datatypedflashvars/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SWFObject add-on: MouseWheel on Mac OS</title>
		<link>http://blog.pixelbreaker.com/open-source/swfmacmousewheel</link>
		<comments>http://blog.pixelbreaker.com/open-source/swfmacmousewheel#comments</comments>
		<pubDate>Wed, 08 Nov 2006 00:13:21 +0000</pubDate>
		<dc:creator>gabes</dc:creator>
				<category><![CDATA[ActionScript 2.0]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://blog.pixelbreaker.com/2006/11/08/flash/deconcept-swfobject-mousewheel-for-mac/</guid>
		<description><![CDATA[I&#8217;ve had the mouse wheel working in flash on OS X for a while, and after seeing the SWFAddress add-on for deconcept&#8217;s SWFObject embedding system, I thought I&#8217;d add mousewheel functionality to SWFObject, rather than using my own &#8220;frankenstein&#8221; embedding system. It&#8217;s straight forward to implement. Download SWFMacMouseWheel here. Within ActionScript, you&#8217;ll barely notice any [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had the mouse wheel working in flash on OS X for a while, and after seeing the <a href="http://www.asual.com/swfaddress/" target="_blank">SWFAddress</a> add-on for <a href="http://blog.deconcept.com/swfobject/" target="_blank">deconcept&#8217;s SWFObject</a> embedding system, I thought I&#8217;d add mousewheel functionality to SWFObject, rather than using my own &#8220;frankenstein&#8221; embedding system.</p>
<p>It&#8217;s straight forward to implement. Download <a href="/downloads/swfmacmousewheel.zip"><span id="mce_editor_0_parent"></span>SWFMacMouseWheel here</a>.</p>
<p><a href="/downloads/swfmacmousewheel.zip"><span id="mce_editor_0_parent"></span></a><br />
<span id="more-9"></span><br />
Within ActionScript, you&#8217;ll barely notice any difference. Only that instead of using Mouse.addListener(), you&#8217;ll refer to my class instead.</p>
<p>Example code:</p>
<p>[as]<br />
import com.pixelbreaker.ui.MouseWheel;</p>
<p>class Example<br />
{</p>
<p>function Example(){<br />
MouseWheel.addListener( this );<br />
}</p>
<p>public function onMouseWheel( delta:Number ):Void<br />
{<br />
// do something with the delta value<br />
}<br />
}</p>
<p>[/as]</p>
<p>All the javascript is included in the zip, with an example html file.</p>
<p>You simply have to add one line of code to the javascript:</p>
<p>[js]<br />
var so = new SWFObject(&#8216;test.swf&#8217;, &#8216;website&#8217;, &#8217;100%&#8217;, &#8217;100%&#8217;, &#8217;8&#8242;, &#8216;#FFFFFF&#8217;);</p>
<p>so.useExpressInstall(&#8216;js/expressinstall.swf&#8217;);</p>
<p>so.addParam(&#8216;menu&#8217;, &#8216;false&#8217;);<br />
so.addParam(&#8216;scale&#8217;, &#8216;noscale&#8217;);<br />
so.addParam(&#8216;salign&#8217;, &#8216;lt&#8217;);</p>
<p>// CHANGE BELOW<br />
if( so.write(&#8216;flashcontent&#8217;) )<br />
{<br />
var macmousewheel = new SWFMacMouseWheel( so );<br />
}<br />
[/js]</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pixelbreaker.com/open-source/swfmacmousewheel/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

