<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-393608813556185274</id><updated>2011-11-27T23:38:38.888Z</updated><category term='String'/><category term='Switch/Case'/><category term='Flash'/><category term='Prototype'/><category term='Array'/><category term='External Interface'/><category term='Function'/><category term='AS2'/><category term='Date'/><category term='Numbers'/><category term='HTML'/><title type='text'>Jack of all Tirades</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-5842367035507794759</id><published>2011-04-01T16:05:00.004+01:00</published><updated>2011-04-01T16:16:45.100+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Function'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><category scheme='http://www.blogger.com/atom/ns#' term='Numbers'/><title type='text'>Lottery Number Function</title><summary type='text'>Again following from a previous discussions on generating unique random numbers within a range, here's a quick function you can use when the range starts from 1, just as most lottery draws do.var getRandomLottoNumbers = function (m:Number, n:Number):Array { m==undefined?m=6:m=m n==undefined?n=49:n=n for(var v=[];m;--n)Math.random()*n&gt;m?0:v[--m]=n;return v}Using it is quite straightforward. Just </summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/5842367035507794759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=5842367035507794759' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/5842367035507794759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/5842367035507794759'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2011/04/lottery-number-function.html' title='Lottery Number Function'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-3903501745416078537</id><published>2009-10-29T15:31:00.006Z</published><updated>2009-10-29T15:52:08.272Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Switch/Case'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><title type='text'>Comparisons with switch/case</title><summary type='text'>The switch and case statements in Actionscript are a useful way of making nested if statements more readable in your code. However they do have one drawback in that the compiler won't allow you to make comparisons. For example, the following code will always skip over the case statements and return the default value:var myVar:Number = 15;switch (myVar) {case (myVar &gt; 0 &amp;&amp; myVar &lt; 11) : trace("</summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/3903501745416078537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=3903501745416078537' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/3903501745416078537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/3903501745416078537'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2009/10/comparisons-with-switchcase.html' title='Comparisons with switch/case'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-8483016104591806740</id><published>2009-09-06T12:02:00.004+01:00</published><updated>2009-09-06T12:06:56.300+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><category scheme='http://www.blogger.com/atom/ns#' term='Prototype'/><category scheme='http://www.blogger.com/atom/ns#' term='String'/><title type='text'>Anagrams</title><summary type='text'>A quick prototype to check if two strings are anagrams of each other:String.prototype.isAnagram = function(string:String):Boolean  { return (this.toLowerCase().split('').sort().join('') == string.toLowerCase().split('').sort().join('')) ? true : false;};Use as follows:string_1 = "dear";string_2 = "read";string_3 = "reed";trace(string_1.isAnagram(string_2)); // truetrace(string_1.isAnagram(string_</summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/8483016104591806740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=8483016104591806740' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/8483016104591806740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/8483016104591806740'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2009/09/anagrams.html' title='Anagrams'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-7304008862269972928</id><published>2009-08-16T17:01:00.007+01:00</published><updated>2009-08-16T19:09:30.284+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Date'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><category scheme='http://www.blogger.com/atom/ns#' term='Prototype'/><title type='text'>Easter revisited</title><summary type='text'>Just changed the previous function to calculate Easter Day into a Date prototype. The prototype automatically returns a new Date() object for Easter for the current year but it will also accept an argument for any year:Date.prototype.calcEaster = function(year:Number):Date  { if(year == null || year == undefined)year = this.getFullYear(); month = Math.floor((((19 * (year % 19) + Math.floor(year /</summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/7304008862269972928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=7304008862269972928' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/7304008862269972928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/7304008862269972928'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2009/08/easter-revisited.html' title='Easter revisited'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-5598682434301394057</id><published>2009-07-17T18:13:00.007+01:00</published><updated>2009-08-28T16:25:51.762+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Array'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><category scheme='http://www.blogger.com/atom/ns#' term='Numbers'/><title type='text'>Generate unique random numbers within a range</title><summary type='text'>Following on from a previous post on how to generate a list of unique random numbers, this similar function will allow you to do the same...but within a predefined range of numbers:function randListFromRange(firstNo:Number, lastNo:Number, num:Number, shuffled:Boolean):Array { var tempArray:Array = []; for (i = firstNo - 1; i &lt; lastNo &amp;&amp; num &gt; 0; ++i) {  if (Math.floor(Math.random() * (lastNo - i)</summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/5598682434301394057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=5598682434301394057' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/5598682434301394057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/5598682434301394057'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2009/07/generate-unique-random-numbers-within.html' title='Generate unique random numbers within a range'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-6548552681646336880</id><published>2009-07-09T23:13:00.011+01:00</published><updated>2009-07-10T00:14:07.924+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='External Interface'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><title type='text'>Change HTML background image</title><summary type='text'>In a similar vein to changing the background colour of a HTML page, this script will allow you to change the background image. Add the following Actionscript and a movieclip with an instance name of "btn":import flash.external.*;var jsCall:String;btn.onPress = function() { jsCall = String(ExternalInterface.call("changeBgImg", "myNewImg.jpg"));};Add the following Javascript to your HTML code:&lt;</summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/6548552681646336880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=6548552681646336880' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/6548552681646336880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/6548552681646336880'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2009/07/change-html-background-image.html' title='Change HTML background image'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-8702942709507569811</id><published>2009-04-03T22:56:00.013+01:00</published><updated>2009-07-09T23:22:50.967+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='External Interface'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><title type='text'>Change HTML background colour</title><summary type='text'>More External Interface stuff. This snippet of code will enable you to change the background colour of a HTML page. Add the following Actionscript and a movieclip with an instance name of "btn":import flash.external.*;var jsCall:String;btn.onPress = function() { jsCall = String(ExternalInterface.call("changeBgColor", "#fffecb));};Add the following Javascript to your HTML code:&lt;script language="</summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/8702942709507569811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=8702942709507569811' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/8702942709507569811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/8702942709507569811'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2009/04/change-html-background-colour.html' title='Change HTML background colour'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-2950417850237308984</id><published>2009-03-01T15:03:00.011Z</published><updated>2009-03-01T15:55:57.779Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Array'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><category scheme='http://www.blogger.com/atom/ns#' term='Numbers'/><title type='text'>Generating a list of unique random numbers</title><summary type='text'>Here's a useful function for generating a list of N random numbers from a larger list M:function randList(max:Number, num:Number, shuffled:Boolean):Array { var tempArray:Array = []; for (i = 0; i &lt; max &amp;&amp; num &gt; 0; ++i) {  if (Math.floor(Math.random() * (max - i)) &lt; num) {   tempArray.push(i + 1);   num--;  } } if (shuffled) {  tempArray.sort(function () {   return Math.floor(Math.random() * 2) ? </summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/2950417850237308984/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=2950417850237308984' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/2950417850237308984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/2950417850237308984'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2009/03/generating-list-of-unique-random.html' title='Generating a list of unique random numbers'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-6854483603453765873</id><published>2008-12-02T19:25:00.010Z</published><updated>2009-01-01T23:17:24.474Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='External Interface'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><title type='text'>Accessing HTML page details</title><summary type='text'>Flash only has a basic in-built property to retrieve details of the HTML page in which an SWF is embedded. You can retrieve the URL of the SWF file itself, for example with the following code:myTxt.text = this._url;Later versions of the Flash player also allow you to retrieve the URL of any JPEGs, GIFs or PNG files by applying the _url property to a movieclip into which any of those filetypes has</summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/6854483603453765873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=6854483603453765873' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/6854483603453765873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/6854483603453765873'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2008/12/accessing-html-page-details.html' title='Accessing HTML page details'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-5926676485003621334</id><published>2008-11-30T23:03:00.013Z</published><updated>2008-12-02T00:34:32.595Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Function'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><category scheme='http://www.blogger.com/atom/ns#' term='Numbers'/><title type='text'>Rounding numbers</title><summary type='text'>Previous posts touched on the subject of formatting numbers; either as formatting currency or separating with commas and two decimal places. Another question that's frequently asked is how to round to different numbers of decimal places?The standard answer is to use powers of 10 as per the following examples. To round to two decimal places use: roundedNumber =  Math.round(yourNumber * 100)/100;</summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/5926676485003621334/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=5926676485003621334' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/5926676485003621334'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/5926676485003621334'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2008/11/rounding-numbers.html' title='Rounding numbers'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-6929810952720625697</id><published>2008-08-06T12:51:00.003+01:00</published><updated>2008-08-06T12:59:07.941+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Function'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><category scheme='http://www.blogger.com/atom/ns#' term='Numbers'/><title type='text'>Formatting currency</title><summary type='text'>Following on from the previous entry about formatting numbers, it's a simple task to convert the same function into one that accepts currency symbols:function formatCurrency(num:Number, comma:Boolean, currency:String):String { // return a zero value if num is not valid if (isNaN(num)) {  return "0.00"; } // return a blank value if currency is not valid if (currency == undefined) {  currency = "";</summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/6929810952720625697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=6929810952720625697' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/6929810952720625697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/6929810952720625697'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2008/08/formatting-currency.html' title='Formatting currency'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-992480922094334896</id><published>2008-08-06T12:35:00.002+01:00</published><updated>2008-08-06T12:50:36.106+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Function'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><category scheme='http://www.blogger.com/atom/ns#' term='Numbers'/><title type='text'>Formatting numbers</title><summary type='text'>This one comes up a lot - how to format a number with commas and decimal points? Just pass your number into this function and it will return a formatted string. Including commas is optional.function formatNumbers(num:Number, comma:Boolean):String { // return a zero value if num is not valid if (isNaN(num)) {  return "0.00"; } // round num to the nearest 100th    num = Math.round(num * 100) / 100;</summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/992480922094334896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=992480922094334896' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/992480922094334896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/992480922094334896'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2008/08/formatting-numbers.html' title='Formatting numbers'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-2521038330213265487</id><published>2008-08-04T08:34:00.019+01:00</published><updated>2009-06-29T11:57:57.564+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Function'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><category scheme='http://www.blogger.com/atom/ns#' term='Numbers'/><title type='text'>Numbers to words in Flash</title><summary type='text'>It is sometimes necessary to convert a given number into its equivalent value in words.At first this might appear to be a daunting and complex task but, fortunately, the method for formulating spoken numbers in English can be broken down into a set of simple rules. These rules are then applicable for any number, regardless of its size:if the number value is zero then the number in words is 'zero'</summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/2521038330213265487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=2521038330213265487' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/2521038330213265487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/2521038330213265487'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2008/08/numbers-to-words-in-flash.html' title='Numbers to words in Flash'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-952812769670724199</id><published>2008-08-02T15:29:00.005+01:00</published><updated>2008-08-02T15:41:11.613+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Function'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><title type='text'>Delay and jump to new frame</title><summary type='text'>A frequent problem is how to delay the timeline, for a given period of time, and then branch to another frame once the delay is up.A bespoke function and the setTimeout function can be combined to do this with ease:stop();var delay:Number = 1000; var frameNumber:Number = 10;function playFrame(frameNumber:Number){    gotoAndStop(frameNumber);}setTimeout(playFrame, delay, frameNumber);delay is the </summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/952812769670724199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=952812769670724199' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/952812769670724199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/952812769670724199'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2008/08/delay-and-jump-to-new-frame.html' title='Delay and jump to new frame'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-926045521093018562</id><published>2008-07-31T04:29:00.006+01:00</published><updated>2008-07-31T21:15:43.679+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Array'/><category scheme='http://www.blogger.com/atom/ns#' term='Function'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><title type='text'>Sorting a numbered list</title><summary type='text'>One task that's quite common is the sorting of data in an array. But there are some pitfalls to bear in mind, particularly when it comes to sorting numbers.For example, take the following simple list and apply a sort:var list:Array = [5, 10, 2, 21, 1, 15];list.sort();trace(list);// outputs [1, 10, 15, 2, 21, 5]Yikes...that didn't go exactly according to plan! So what happened? By default, the </summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/926045521093018562/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=926045521093018562' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/926045521093018562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/926045521093018562'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2008/07/sorting-numbered-list.html' title='Sorting a numbered list'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-2321693727502425479</id><published>2008-07-30T14:47:00.015+01:00</published><updated>2008-07-31T12:07:22.334+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Function'/><category scheme='http://www.blogger.com/atom/ns#' term='Date'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><title type='text'>When the heck is Easter?</title><summary type='text'>Thanks to some arcane historical, and religious reasons, Easter has a tendency to slide around the calendar like a drunk man on an ice-rink. Fortunately it is still possible to calculate when it occurs in Flash with the following function:function calcEaster(year) {Months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "</summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/2321693727502425479/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=2321693727502425479' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/2321693727502425479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/2321693727502425479'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2008/07/when-heck-is-easter.html' title='When the heck is Easter?'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-2454629812856911154</id><published>2008-07-30T14:30:00.011+01:00</published><updated>2009-04-04T01:34:43.183+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Function'/><category scheme='http://www.blogger.com/atom/ns#' term='Date'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><title type='text'>Ordinal Numbers in Flash</title><summary type='text'>We use ordinal numbers all the time, even though we may not always appreciate what they are, or why we're using them.An ordinal number reflects the rank of that number in a particular order, or its position. So we might use expressions like "he came first in the race", or "that's the third bus to come along in the past hour", or "today is the thirtieth of July". When we write down ordinal numbers</summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/2454629812856911154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=2454629812856911154' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/2454629812856911154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/2454629812856911154'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2008/07/ordinal-numbers-in-flash.html' title='Ordinal Numbers in Flash'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-8337720376671652610</id><published>2008-07-30T13:56:00.013+01:00</published><updated>2009-09-20T22:26:58.597+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Function'/><category scheme='http://www.blogger.com/atom/ns#' term='Date'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><title type='text'>Calculating the nth Date in Flash</title><summary type='text'>One thing that's not easy to calculate in Flash is the occurrence of floating dates. For example, in the US, Thanksgiving Day occurs on the fourth Thursday of November whereas, in Canada, it occurs on the second Monday of October. But how do you calculate which is the fourth Thursday or the second Monday in any given month?The answer is this function:function nthDay(nth, weekday, month, year) { </summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/8337720376671652610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=8337720376671652610' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/8337720376671652610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/8337720376671652610'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2008/07/calculating-nth-date-in-flash.html' title='Calculating the nth Date in Flash'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-393608813556185274.post-8417020693312323392</id><published>2008-07-30T13:09:00.034+01:00</published><updated>2008-07-30T22:05:40.908+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Function'/><category scheme='http://www.blogger.com/atom/ns#' term='Date'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='AS2'/><title type='text'>Validating Dates in Flash</title><summary type='text'>Having seen a plethora of functions that attempt to validate dates in Flash, almost all of them involving various methods of splicing strings and a whole heap of conditional if statements to check for leap years, month lengths, etc., I thought it would probably be a lot simpler to let the Date Object itself do the checking:function isValidDate(day, month, year):Boolean {var d:Date = new Date(year</summary><link rel='replies' type='application/atom+xml' href='http://flashpants.blogspot.com/feeds/8417020693312323392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=393608813556185274&amp;postID=8417020693312323392' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/8417020693312323392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/393608813556185274/posts/default/8417020693312323392'/><link rel='alternate' type='text/html' href='http://flashpants.blogspot.com/2008/07/validating-dates-in-flash.html' title='Validating Dates in Flash'/><author><name>glosrfc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
