<?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>agitated Observer &#187; snippet</title>
	<atom:link href="http://agitatedobserver.com/tags/snippet/feed/" rel="self" type="application/rss+xml" />
	<link>http://agitatedobserver.com</link>
	<description>Observations from the agitated one.</description>
	<lastBuildDate>Sun, 08 Nov 2009 13:54:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AS3: Random Colour between 2 colour values</title>
		<link>http://agitatedobserver.com/as3-random-colour-between-2-colour-values/</link>
		<comments>http://agitatedobserver.com/as3-random-colour-between-2-colour-values/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 02:13:34 +0000</pubDate>
		<dc:creator>AGI</dc:creator>
				<category><![CDATA[Flash / Actionscript]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[colour values]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://agitatedobserver.com/?p=379</guid>
		<description><![CDATA[Useful little snippet to generate a colour between 2 colour values in ActionScript 3
12345678910111213import fl.motion.Color;

var color1:uint = 0x03e338;
var color2:uint = 0xbbe303;
var newColor:uint = Color.interpolateColor&#40;color1, color2, randomHue&#41;;

private function _randomNumber&#40;low:Number=NaN, high:Number=NaN&#41;:Number
&#123;
&#160; &#160; var low:Number = low;
&#160; &#160; var high:Number = high;

&#160; &#160; return Math.random&#40;&#41; * &#40;high - low&#41; + low;
&#125;
Related Posts:AS3 Currency FormatterSimple way to randomise Arrays [...]]]></description>
			<content:encoded><![CDATA[<p>Useful little snippet to generate a colour between 2 colour values in ActionScript 3</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">import</span> fl<span style="color: #000066; font-weight: bold;">.</span>motion<span style="color: #000066; font-weight: bold;">.</span>Color<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #6699cc; font-weight: bold;">var</span> color1<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = 0x03e338<span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> color2<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = 0xbbe303<span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> newColor<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = Color<span style="color: #000066; font-weight: bold;">.</span>interpolateColor<span style="color: #000000;">&#40;</span>color1<span style="color: #000066; font-weight: bold;">,</span> color2<span style="color: #000066; font-weight: bold;">,</span> randomHue<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> _randomNumber<span style="color: #000000;">&#40;</span>low<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a>=<span style="color: #004993;">NaN</span><span style="color: #000066; font-weight: bold;">,</span> high<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a>=<span style="color: #004993;">NaN</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> low<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = low<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> high<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = high<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span>high <span style="color: #000066; font-weight: bold;">-</span> low<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">+</span> low<span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://agitatedobserver.com/as3-currency-formatter/" rel="bookmark">AS3 Currency Formatter</a></li><li><a href="http://agitatedobserver.com/simple-way-to-randomise-arrays-in-as3/" rel="bookmark">Simple way to randomise Arrays in AS3</a></li><li><a href="http://agitatedobserver.com/snippet-easy-globaltolocal-in-as3/" rel="bookmark">Snippet: Easy globalToLocal in AS3</a></li><li><a href="http://agitatedobserver.com/youre-going-to-wake-up-the-rest-of-the-bitches/" rel="bookmark">You're waking up the rest of the bitches...</a></li><li><a href="http://agitatedobserver.com/metamorphosis-by-glenn-marshall/" rel="bookmark">Metamorphosis by Glenn Marshall</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://agitatedobserver.com/as3-random-colour-between-2-colour-values/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snippet: Easy globalToLocal in AS3</title>
		<link>http://agitatedobserver.com/snippet-easy-globaltolocal-in-as3/</link>
		<comments>http://agitatedobserver.com/snippet-easy-globaltolocal-in-as3/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 00:35:30 +0000</pubDate>
		<dc:creator>AGI</dc:creator>
				<category><![CDATA[Flash / Actionscript]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://agitatedobserver.com/?p=320</guid>
		<description><![CDATA[Short little snippet I found the other day to convert coordinates from one movieclip to another in Actionscript 3
123456function localToLocal&#40;fr:MovieClip, to:MovieClip&#41;:Point &#123;
&#160; &#160; return to.globalToLocal&#40;fr.localToGlobal&#40;new Point&#40;&#41;&#41;&#41;;
&#125;;

//Useage
var localPoint:Point = localToLocal&#40;fromMc,toMc&#41;;
Related Posts:AS3: Random Colour between 2 colour valuesSimple way to randomise Arrays in AS3Simple AS3 dynamic fonts classAS3 Currency FormatterSubmission for IF: Contained]]></description>
			<content:encoded><![CDATA[<p>Short little snippet I found the other day to convert coordinates from one movieclip to another in Actionscript 3</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339966; font-weight: bold;">function</span> localToLocal<span style="color: #000000;">&#40;</span>fr<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a><span style="color: #000066; font-weight: bold;">,</span> to<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html"><span style="color: #004993;">Point</span></a> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> to<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">globalToLocal</span><span style="color: #000000;">&#40;</span>fr<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">localToGlobal</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html"><span style="color: #004993;">Point</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">//Useage</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> localPoint<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html"><span style="color: #004993;">Point</span></a> = localToLocal<span style="color: #000000;">&#40;</span>fromMc<span style="color: #000066; font-weight: bold;">,</span>toMc<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></td></tr></tbody></table></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://agitatedobserver.com/as3-random-colour-between-2-colour-values/" rel="bookmark">AS3: Random Colour between 2 colour values</a></li><li><a href="http://agitatedobserver.com/simple-way-to-randomise-arrays-in-as3/" rel="bookmark">Simple way to randomise Arrays in AS3</a></li><li><a href="http://agitatedobserver.com/simple-as3-dynamic-fonts-class/" rel="bookmark">Simple AS3 dynamic fonts class</a></li><li><a href="http://agitatedobserver.com/as3-currency-formatter/" rel="bookmark">AS3 Currency Formatter</a></li><li><a href="http://agitatedobserver.com/submission-for-illustration-friday-contained/" rel="bookmark">Submission for IF: Contained</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://agitatedobserver.com/snippet-easy-globaltolocal-in-as3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>AS3 Currency Formatter</title>
		<link>http://agitatedobserver.com/as3-currency-formatter/</link>
		<comments>http://agitatedobserver.com/as3-currency-formatter/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 02:41:09 +0000</pubDate>
		<dc:creator>AGI</dc:creator>
				<category><![CDATA[Flash / Actionscript]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[currency format]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://agitatedobserver.com/?p=285</guid>
		<description><![CDATA[Here&#8217;s a little class I created to convert any number into currency format, which allows specification of decimal places and currency symbol.
Download the Currency Formatter AS3 class
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980/* Use:
&#160;* 
&#160;* import agi.utils.Format
&#160;* 
&#160;* var _format:Format = &#160;new Format();
&#160;* 
&#160;* trace out:
&#160;* trace(_format.currency(32783.2397,2,$)); //$32,783.24
&#160;* trace(_format.currency(32783.2397,3,$)); //$32,783.240
&#160;* trace(_format.currency(32783.2397,2,&#34;&#34;)); //32,783.24
&#160;* 
&#160;*/
package agi.utils
&#123;
&#160; &#160; public class Format
&#160; &#160; &#123;
&#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a little class I created to convert any number into currency format, which allows specification of decimal places and currency symbol.</p>
<p>Download the <a href="http://agitatedobserver.com/wp-content/uploads/2009/03/currencyclass.zip">Currency Formatter AS3 class</a></p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:420px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #3f5fbf;">/* Use:<br />
&nbsp;* <br />
&nbsp;* import agi.utils.Format<br />
&nbsp;* <br />
&nbsp;* var _format:Format = &nbsp;new Format();<br />
&nbsp;* <br />
&nbsp;* trace out:<br />
&nbsp;* trace(_format.currency(32783.2397,2,$)); //$32,783.24<br />
&nbsp;* trace(_format.currency(32783.2397,3,$)); //$32,783.240<br />
&nbsp;* trace(_format.currency(32783.2397,2,&quot;&quot;)); //32,783.24<br />
&nbsp;* <br />
&nbsp;*/</span><br />
<span style="color: #9900cc; font-weight: bold;">package</span> agi<span style="color: #000066; font-weight: bold;">.</span>utils<br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Format<br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//-----------CONSTRUCTOR-----------//</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Format<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//-----------PRIVATE METHODS-----------//</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> currency<span style="color: #000000;">&#40;</span>num<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">,</span>decimalPlace<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a>=2<span style="color: #000066; font-weight: bold;">,</span>currency<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a>=<span style="color: #990000;">&quot;$&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//assigns true boolean value to neg in number less than 0</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> neg<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"><span style="color: #004993;">Boolean</span></a> = <span style="color: #000000;">&#40;</span>num <span style="color: #000066; font-weight: bold;">&lt;</span> 0<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//make the number positive for easy conversion</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num = <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">abs</span><span style="color: #000000;">&#40;</span>num<span style="color: #000000;">&#41;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> roundedAmount<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000000;">&#40;</span>num<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">toFixed</span><span style="color: #000000;">&#40;</span>decimalPlace<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//split string into array for dollars and cents</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> amountArray<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a> = roundedAmount<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">split</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> dollars<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = amountArray<span style="color: #000000;">&#91;</span>0<span style="color: #000000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> cents<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = amountArray<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//create dollar amount</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> dollarFinal<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span>i<span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> dollars<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>i <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> <span style="color: #000000;">&#40;</span>i <span style="color: #000066; font-weight: bold;">%</span> <span style="color: #000000; font-weight:bold;">3</span> == <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dollarFinal = <span style="color: #990000;">&quot;,&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> dollarFinal<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dollarFinal = dollars<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">substr</span><span style="color: #000000;">&#40;</span> <span style="color: #000066; font-weight: bold;">-</span>i <span style="color: #000066; font-weight: bold;">-</span>1<span style="color: #000066; font-weight: bold;">,</span> 1<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">+</span> dollarFinal<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//create Cents amount and zeros if necessary</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> centsFinal<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000000;">&#40;</span>cents<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> missingZeros<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = decimalPlace <span style="color: #000066; font-weight: bold;">-</span> centsFinal<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>centsFinal<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">&lt;</span> decimalPlace<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> j<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> j <span style="color: #000066; font-weight: bold;">&lt;</span> missingZeros<span style="color: #000066; font-weight: bold;">;</span> j<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; centsFinal <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;0&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> finalString<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;&quot;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>neg<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; finalString = <span style="color: #990000;">&quot;-&quot;</span><span style="color: #000066; font-weight: bold;">+</span>currency <span style="color: #000066; font-weight: bold;">+</span> dollarFinal<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; finalString = currency <span style="color: #000066; font-weight: bold;">+</span> dollarFinal<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>decimalPlace <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; finalString <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;.&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> centsFinal<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> finalString<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://agitatedobserver.com/as3-random-colour-between-2-colour-values/" rel="bookmark">AS3: Random Colour between 2 colour values</a></li><li><a href="http://agitatedobserver.com/simple-way-to-randomise-arrays-in-as3/" rel="bookmark">Simple way to randomise Arrays in AS3</a></li><li><a href="http://agitatedobserver.com/simple-as3-dynamic-fonts-class/" rel="bookmark">Simple AS3 dynamic fonts class</a></li><li><a href="http://agitatedobserver.com/snippet-easy-globaltolocal-in-as3/" rel="bookmark">Snippet: Easy globalToLocal in AS3</a></li><li><a href="http://agitatedobserver.com/instabudget09-launched/" rel="bookmark">INSTABUDGET09 launched</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://agitatedobserver.com/as3-currency-formatter/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>
