RE: [Flashcoders] least to greatest
Put them in the array as is and then use Array.Sort()? Dave From: "Corban Baxter" <[EMAIL PROTECTED]> Reply-To: flashcoders@chattyfig.figleaf.com To: "Flashcoders mailing list" Subject: [Flashcoders] least to greatest Date: Fri, 6 Jul 2007 08:50:20 -0500 Hey all I have a list of 10 numbers that I need to push into and array from least to greatest fairly often. What would be the fastest way to get this accomplished? Or maybe just anyway to get this done would be a great help thanks. -- Corban Baxter http://www.projectx4.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com _ http://newlivehotmail.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] least to greatest
Assuming you have something like this: var list:String = "7,60,5,9,11,13,1"; var listArr:Array = list.split(","); listArr.sort(); That should do it. On 7/6/07, Corban Baxter <[EMAIL PROTECTED]> wrote: Hey all I have a list of 10 numbers that I need to push into and array from least to greatest fairly often. What would be the fastest way to get this accomplished? Or maybe just anyway to get this done would be a great help thanks. -- Corban Baxter http://www.projectx4.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] least to greatest
Hey You can push the numbers by using Array.push(The number). After that if you need to arrange that elements in a array you need to sort that array using array. sort(2) where 2 is the options number for sorting which represents descending Durai www.expertbuddy.net -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corban Baxter Sent: Friday, July 06, 2007 7:20 PM To: Flashcoders mailing list Subject: [Flashcoders] least to greatest Hey all I have a list of 10 numbers that I need to push into and array from least to greatest fairly often. What would be the fastest way to get this accomplished? Or maybe just anyway to get this done would be a great help thanks. -- Corban Baxter http://www.projectx4.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com DISCLAIMER: This communication may be confidential and privileged and the views expressed herein may be personal and are not necessarily the views of ReDIM. It is for the exclusive use of the intended recipient. If you are not the intended recipient, please note that any distribution, copying or use of this communication or the information in it is strictly prohibited.If you have received this communication in error, please notify us by email ([EMAIL PROTECTED]) and then delete the email and any copies of it. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] least to greatest
thanks for all the help guys. I am going to play with sort and see if I can't get this to work. On 7/6/07, Steve Abaffy <[EMAIL PROTECTED]> wrote: I am not sure if there is a sort method for arrays such as Array.Sort(direction) if such a function does not exists then you can always write a quick bubble sort function. function bubblesort(ArrayName){ changesmade = true; for(y = 0; y < ArrayName.Length; y++{ if(changesmade){ changesmade = false; for(x = 0; x < ArrayName.Length-1; x++){ if(ArrayName[x] < ArrayName[x+1]){ temp = ArrayName[x]; ArrayName[x] = ArrayName[x+1]; ArrayName[x+1] = temp; Changesmade = true; } } } } Return ArrayName; } If you want to sort in accending order or descending order as well the if statement just needs to have the less than sign changed to a greater than sign. There are ways of speeding this function up you can put in a variable that checks to see if you made any changes to the array with each pass If no changes were made then array is sorted. But I might not bother with this step for only 10 variables. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corban Baxter Sent: Friday, July 06, 2007 8:50 AM To: Flashcoders mailing list Subject: [Flashcoders] least to greatest Hey all I have a list of 10 numbers that I need to push into and array from least to greatest fairly often. What would be the fastest way to get this accomplished? Or maybe just anyway to get this done would be a great help thanks. -- Corban Baxter http://www.projectx4.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- Corban Baxter http://www.projectx4.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] least to greatest
The array class in Flash has a sort numeric (least to greatest) feature: var myArray:Array = new Array(); myArray.push(5); myArray.push(1); myArray.push(65); myArray.push(3); myArray.push(56); myArray.push(9); myArray.push(-2); myArray.push(44); myArray.push(7); myArray.push(8); myArray.push(10); trace("myArray: " + myArray); // myArray: 5,1,65,3,56,9,-2,44,7,8,10 myArray.sort(Array.NUMERIC ); trace("myArray: " + myArray); // myArray: -2,1,3,5,7,8,9,10,44,56,65 Would this work, or do you need to have the numbers pushed onto the array in a specific order to begin with? Daniel Holth I.S. Programmer x5217 || J401 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corban Baxter Sent: Friday, July 06, 2007 8:50 AM To: Flashcoders mailing list Subject: [Flashcoders] least to greatest Hey all I have a list of 10 numbers that I need to push into and array from least to greatest fairly often. What would be the fastest way to get this accomplished? Or maybe just anyway to get this done would be a great help thanks. -- Corban Baxter http://www.projectx4.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com This e-mail and its attachments are intended only for the use of the addressee(s) and may contain privileged, confidential or proprietary information. If you are not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution, displaying, copying, or use of this information is strictly prohibited. If you have received this communication in error, please inform the sender immediately and delete and destroy any record of this message. Thank you. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] least to greatest
I am not sure if there is a sort method for arrays such as Array.Sort(direction) if such a function does not exists then you can always write a quick bubble sort function. function bubblesort(ArrayName){ changesmade = true; for(y = 0; y < ArrayName.Length; y++{ if(changesmade){ changesmade = false; for(x = 0; x < ArrayName.Length-1; x++){ if(ArrayName[x] < ArrayName[x+1]){ temp = ArrayName[x]; ArrayName[x] = ArrayName[x+1]; ArrayName[x+1] = temp; Changesmade = true; } } } } Return ArrayName; } If you want to sort in accending order or descending order as well the if statement just needs to have the less than sign changed to a greater than sign. There are ways of speeding this function up you can put in a variable that checks to see if you made any changes to the array with each pass If no changes were made then array is sorted. But I might not bother with this step for only 10 variables. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corban Baxter Sent: Friday, July 06, 2007 8:50 AM To: Flashcoders mailing list Subject: [Flashcoders] least to greatest Hey all I have a list of 10 numbers that I need to push into and array from least to greatest fairly often. What would be the fastest way to get this accomplished? Or maybe just anyway to get this done would be a great help thanks. -- Corban Baxter http://www.projectx4.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] least to greatest
Hey all I have a list of 10 numbers that I need to push into and array from least to greatest fairly often. What would be the fastest way to get this accomplished? Or maybe just anyway to get this done would be a great help thanks. -- Corban Baxter http://www.projectx4.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com