Objects work pretty much like hashtables (from my understanding).
Hashtables generally don't guarantee any kind of ordering.  Flash may
enforce some kind of ordering (y seems to be going in reverse order of
when things were added) but I don't know of any ordering and generally
treat it as arbitrary.

Now, if you were using Arrays then your ordering would be guaranteed
(for-in loops go backwards through the array I believe).

  -Andy

On 9/11/07, Mendelsohn, Michael <[EMAIL PROTECTED]> wrote:
> Hi list...
>
> I want object y, below, to output in the same order as x.  Is it
> possible?
>
> Thanks,
> - Michael M.
>
> x = {a:"first", b:"second", c:"third"};
> for (i in x) {
>    trace(i + ": " + x[i]);
> }
> /*
> output:
> a: first
> b: second
> c: third
> */
>
>
> y = new Object();
> y["a"] = "first";
> y["b"] = "second";
> y["c"] = "third";
> for (i in y) {
>    trace(i + ": " + y[i]);
> }
> /*
> output:
> c: third
> b: second
> a: first
> */
> _______________________________________________
> 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

Reply via email to