<?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>The efnx code blog. &#187; class</title>
	<atom:link href="http://efnx.com/tag/class/feed/" rel="self" type="application/rss+xml" />
	<link>http://efnx.com</link>
	<description>code. blog.</description>
	<lastBuildDate>Sat, 03 Jul 2010 18:02:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Flash Actionscript 3 Waveform Generation Class</title>
		<link>http://efnx.com/flash-actionscript-3-waveform-generation-class/</link>
		<comments>http://efnx.com/flash-actionscript-3-waveform-generation-class/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 22:45:35 +0000</pubDate>
		<dc:creator>Schell</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[Sound]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[Wave]]></category>
		<category><![CDATA[waveform]]></category>

		<guid isPermaLink="false">http://blog.efnx.com/?p=90</guid>
		<description><![CDATA[In my last post, Plotting a Sound Wave in Flash AS3 I detailed a method to use when displaying audio data. The method itself works great, but due to Flash&#8217;s frame-based code execution and event processing the user looses input capabilities while the flash player chugs through millions of numbers adding, rounding and comparing. In [...]]]></description>
			<content:encoded><![CDATA[<p>In my last post, <a href="http://blog.efnx.com/?p=75">Plotting a Sound Wave in Flash AS3</a> I detailed a method to use when displaying audio data. The method itself works great, but due to Flash&#8217;s frame-based code execution and event processing the user looses input capabilities while the flash player chugs through millions of numbers adding, rounding and comparing. In order to make displaying an audio waveform easier on both the programmer and the user I wrote a class that analyzes a Sound object progressively, and dispatches a special event containing the analyzed data. The class will construct a left and right channel Vector, each containing one data point [a number between 0 and 1] for a given number of <a href="http://en.wikipedia.org/wiki/Window_function">windows</a>, between two positions in the sound. The left and right position are measured in samples and two types of analyzation are offered. Here is a demo of the class in action:<br />
<div class="wp-caption aligncenter" style="width: 578px"><a href="http://efnx.com/lab/WavePlotter/"><img alt="Screen Capture of Waveform Plot" src="http://efnx.com/lab/WavePlotter/waveform_screen.png" title="Waveform Plot" width="568" height="237" /></a><p class="wp-caption-text">Screen Capture of Waveform Plot</p></div><br />
The calculated data can be reached incrementally through the WaveformEvent object which is dispatched every frame, or at the end of all analyzation in the Waveform object&#8217;s leftChannel and rightChannel properties. The details are listed in the documentation below.</p>
<p>Thanks to the <a href="http://summitprojectsflashblog.wordpress.com/2008/07/31/wave-theory-in-actionscript-3/">Summit Projects Flash Blog</a> and <a href="http://www.bytearray.org/?p=329">Thibault Imbert at ByteArray</a> for their posts on the different techniques that went into my class.</p>
<p><a name="source"><strong>Source</strong></a><br />
Here is the source for my TextMate project: <a href="http://efnx.com/lab/WavePlotter/src/WavePlotter_Main_081024.src.tar.gz">Sources</a><br />
Documentation: <a href="http://efnx.com/docs/efnx/sound/Waveform.html">class</a> and <a href="http://efnx.com/docs/efnx/events/WaveformEvent.html">event</a></p>
<p>And here is a Flex version (made in windows): // Thanks dem!<br />
<a href='http://blog.efnx.com/wp-content/uploads/2009/11/WavePlotter_Main.zip'>Sources (Flex version)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://efnx.com/flash-actionscript-3-waveform-generation-class/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>AS3 Classes and Interfaces Quicktip</title>
		<link>http://efnx.com/as3-classes-and-interfaces-quicktip/</link>
		<comments>http://efnx.com/as3-classes-and-interfaces-quicktip/#comments</comments>
		<pubDate>Sat, 19 Jan 2008 18:37:00 +0000</pubDate>
		<dc:creator>Schell</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[interface]]></category>

		<guid isPermaLink="false">http://blog.efnx.com/?p=42</guid>
		<description><![CDATA[Interfaces in AS3 are super useful for requiring classes to support a set of public methods, enabling other classes to communicate through the interface thereby abstracting the class itself. AS3 doesn&#8217;t natively support abstract classes so using Interfaces is a good replacement in some cases, but if you&#8217;ve never used an Interface before you probably [...]]]></description>
			<content:encoded><![CDATA[<p>Interfaces in AS3 are super useful for requiring classes to support a set of public methods, enabling other classes to communicate through the interface thereby abstracting the class itself. AS3 doesn&#8217;t natively support abstract classes so using Interfaces is a good replacement in some cases, but if you&#8217;ve never used an Interface before you probably wouldn&#8217;t know how to implement it. The docs help a little, showing you how to instantiate a class using an interface with the &#8220;implements&#8221; keyword, but doesn&#8217;t go much further:</p>
<div class="codecolorer-container actionscript twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> myClass <span style="color: #0066CC;">implements</span> myInterface<span style="color: #66cc66;">&#123;</span><br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>But what if you&#8217;d like to implement a class while extending another? Well, it&#8217;s simple once you know the syntax&#8230;</p>
<div class="codecolorer-container actionscript twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> myClass <span style="color: #0066CC;">extends</span> baseClass <span style="color: #0066CC;">implements</span> myInterface <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>This is a very quick and simple tip that took me a while to find online due to the fact Adobe doesn&#8217;t mention it. Such a simple thing should be in the help docs, but I guess adobe thinks that anyone trying to use Interfaces would already know the syntax! Well now you do. </p>
]]></content:encoded>
			<wfw:commentRss>http://efnx.com/as3-classes-and-interfaces-quicktip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple Bitmap Loader in AS3</title>
		<link>http://efnx.com/multiple-bitmap-loader-in-as3/</link>
		<comments>http://efnx.com/multiple-bitmap-loader-in-as3/#comments</comments>
		<pubDate>Mon, 26 Nov 2007 00:34:39 +0000</pubDate>
		<dc:creator>Schell</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[animated]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[GIF]]></category>
		<category><![CDATA[load]]></category>
		<category><![CDATA[resources]]></category>

		<guid isPermaLink="false">http://blog.efnx.com/?p=30</guid>
		<description><![CDATA[To aid in my projects I have written a simple bitmapData loading class entitled aquireResources. This class takes an array of image paths as strings and proceeds to load them one by one. A &#8220;complete&#8221; event is dispatched when loading is completed and the bitmapData of each loading instance are saved in an array in [...]]]></description>
			<content:encoded><![CDATA[<p>To aid in my projects I have written a simple bitmapData loading class entitled aquireResources. This class takes an array of image paths as strings and proceeds to load them one by one. A &#8220;complete&#8221; event is dispatched when loading is completed and the bitmapData of each loading instance are saved in an array in the order they were given. Calling the aquireResources.array() method returns the array of bitmapData. If you&#8217;ve already downloaded Thibault Imbert (bytearray.org)&#8217;s GIFPlayer and GIFDecoder classes you can uncomment the included properties and methods in my class and enable the aquireResources class to load multiple instances of animated GIFs into AS3 as arrays of bitmapData. In this case aquireResources.array() returns a two-dimensional array containing one array of bitmapData per animated GIF passed to it.</p>
<p><b>Usage</b></p>
<div class="codecolorer-container actionscript twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">import</span> com.<span style="color: #006600;">efnx</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">aquireResources</span>;<br />
<br />
<span style="color: #000000; font-weight: bold;">var</span> rsrc:aquireResources = <span style="color: #000000; font-weight: bold;">new</span> aquireResources<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;rsrc.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;complete&quot;</span>, onComplete, <span style="color: #000000; font-weight: bold;">false</span>, 0, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">array</span>:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;imagePath1/image1.png&quot;</span>, <span style="color: #ff0000;">&quot;imagePath2/image2.gif&quot;</span>, <span style="color: #ff0000;">&quot;imagePath3/image3.jpeg&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">var</span> bitmapDataArray:<span style="color: #0066CC;">Array</span>;<br />
<span style="color: #000000; font-weight: bold;">function</span> onComplete<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp;bitmapDataArray = rsrc.<span style="color: #0066CC;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
rsrc.<span style="color: #006600;">aquireImages</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">array</span><span style="color: #66cc66;">&#41;</span>;</div></div>
<p><b>For loading animated GIFs</b></p>
<div class="codecolorer-container actionscript twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">import</span> com.<span style="color: #006600;">efnx</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">aquireResources</span>;<br />
<br />
<span style="color: #000000; font-weight: bold;">var</span> rsrc:aquireResources = <span style="color: #000000; font-weight: bold;">new</span> aquireResources<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;rsrc.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;complete&quot;</span>, onComplete, <span style="color: #000000; font-weight: bold;">false</span>, 0, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">array</span>:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;imagePath1/image1.gif&quot;</span>, <span style="color: #ff0000;">&quot;imagePath2/image2.gif&quot;</span>, <span style="color: #ff0000;">&quot;imagePath3/image3.gif&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #000000; font-weight: bold;">var</span> animatedArray:<span style="color: #0066CC;">Array</span>;<br />
<span style="color: #000000; font-weight: bold;">function</span> onComplete<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp;animatedArray = rsrc.<span style="color: #0066CC;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
rsrc.<span style="color: #006600;">aquireGIFs</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">array</span><span style="color: #66cc66;">&#41;</span>;</div></div>
<p><b>Source</b><br />
<a href='http://blog.efnx.com/wp-content/uploads/2007/11/blogefnxcom-aquireresources.zip' title='aquireResources Source'>aquireResources Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://efnx.com/multiple-bitmap-loader-in-as3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Simple Tiling Sprite Class in AS3</title>
		<link>http://efnx.com/conveniently-simple-tiling-sprite/</link>
		<comments>http://efnx.com/conveniently-simple-tiling-sprite/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 01:33:11 +0000</pubDate>
		<dc:creator>Schell</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[simple tile]]></category>
		<category><![CDATA[tile]]></category>
		<category><![CDATA[tiling background]]></category>

		<guid isPermaLink="false">http://blog.efnx.com/?p=25</guid>
		<description><![CDATA[Also known as &#8220;Developing a Pure AS3 GUI &#8211; Part 1.5 (tile)
Jump to Source
After writing last night&#8217;s class, scalingBars, I decided to make it a little easier on myself to tile bitmaps across the screen. I wrote a simple class that when given either a BitmapData object or a path to an image file (as [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Also known as &#8220;Developing a Pure AS3 GUI &#8211; Part 1.5 (tile)</strong><br />
<a href="#source">Jump to Source</a><br />
After writing last night&#8217;s class, <a href="http://blog.efnx.com/?p=20">scalingBars</a>, I decided to make it a little easier on myself to tile bitmaps across the screen. I wrote a simple class that when given either a BitmapData object or a path to an image file (as a String), class will tile the image x pixels in width and y pixels in height. This is great for backgrounds or window bars or box sides, etc. Here&#8217;s the usage:</p>
<div class="codecolorer-container actionscript twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">var</span> bar:tile = <span style="color: #000000; font-weight: bold;">new</span> tile<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;pathToImageOrBitmapDataObject&quot;</span>, 100, 150<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;addChild<span style="color: #66cc66;">&#40;</span>bar<span style="color: #66cc66;">&#41;</span>;</div></div>
<p>The previous code will grab an image from &#8220;pathToImage&#8221; [either relative or absolute, but remember security!] and then tile it 100 pixels wide by 150 pixels tall. Simple. Now let&#8217;s say you wanted to resize it:</p>
<div class="codecolorer-container actionscript twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">bar.<span style="color: #006600;">resize</span><span style="color: #66cc66;">&#40;</span>20, 40<span style="color: #66cc66;">&#41;</span>;</div></div>
<p>That code will re-tile the image to 20 pixels by 40 pixels. Next on my list of upgrades is to allow reloading of different images. Shouldn&#8217;t be too hard.<br />
<strong>Example</strong><br />
<iframe width="100%" height="400" src="http://blog.efnx.com/wp-content/uploads/2007/11/tile.html"></iframe><br />
<strong><a name="#source">Source</a></strong><br />
<a href='http://blog.efnx.com/wp-content/uploads/2007/11/blogefnxcom-tile.zip' title='tile Class Source Code'>tile Class Source Code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://efnx.com/conveniently-simple-tiling-sprite/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>
