You can also try this:

var myArray:Array = ["one","two","three"];
//order myArray in reverse
myArray = myArray.reverse();
for(var i in myArray){
        trace(myArray[i]);
}
//order myArray as it originally was
myArray = myArray.reverse();

But as was already brought out for...in can be unpredictable

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ron
Wheeler
Sent: Tuesday, June 20, 2006 9:49 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] For...in counts backwards?



Mendelsohn, Michael wrote:
> Hi list...
>
> >From the help on "for...in":
>
> You can also iterate through the elements of an array:
>
> var myArray:Array = ["one", "two", "three"];
> for (var i:String in myArray) {
>     trace(myArray[i]);
> }
>
>
> This code outputs the following in the Output panel:
>
> three
> two
> One
>
>
> Why is the data output in reverse order and is there any way of
ordering
> it one,two,three?
>
>   
Why is any order better than another. one,two,three is not the correct 
alphabetic sort order.
How would you order

var myArray:Array = ["cat", "pig", "dog"];

Alphabetic, by average weight, by popularity???

If you want an associative array to have some sort of order that depends

on some interpretation of meaning, you will have to do that yourself.

What are you really trying to do? There is probably a simple solution. 
Perhaps you do not really want and associative array at all?
> Thanks,
> - Michael M.
>
> _______________________________________________
> [email protected]
> 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
>
>
>
>   
_______________________________________________
[email protected]
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


************************
MLB.com: Where Baseball is Always On


_______________________________________________
[email protected]
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

Reply via email to