RE: [Flashcoders] Traversing through Object goes backwards

2007-09-13 Thread Mendelsohn, Michael
Thanks for the response Andy.  I just ended up doing this:


public function reverseObject(objToReverse:Object):Object {
// reverses the object again after built, meaning it's now in
the right order
var alteredObj:Object = new Object();
for (var i in objToReverse) {
alteredObj[i] = objToReverse[i];
}
return alteredObj;
}






 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).
___
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] Traversing through Object goes backwards

2007-09-13 Thread eka
Hello :)

Use my framework and this ADT package based on the JAVA collections
framework :

The Map and the SortedArrayMap tutorial :

http://code.google.com/p/vegas/wiki/VegasTutorials_collection_map

My SortedArrayMap can help you :)

You can use my vegas.data package in AS2/AS3 and SSAS :)

Page project :
http://code.google.com/p/vegas/

Installation :
http://code.google.com/p/vegas/wiki/InstallVEGASwithSVN

EKA+ :)



2007/9/12, Andy Herrman [EMAIL PROTECTED]:

 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

___
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] Traversing through Object goes backwards

2007-09-12 Thread Andy Herrman
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