actionscript - how does the FlashBuilder debugger know the order in which items were added to an associative array with string keys? -


I have an array of objects that are used as keys using a delimited string when checked in FB4 debugger , Then the keys look like this:

 [+] 22477◦25220◦20.1 [+] 22477◦25220◦20.6 [+] 22477◦25220◦20.8 [+] 22477◦25244 ◦ 55.1K ( J) 

The first two items are numeric (inserted for string), but in the multi-part delimited key, the third object is naturally a string - it is an alphanumeric Like that library shell context. When expected, when you click the [+] icon in the debugger, you can see the object related to that string key. So far so good.

Debugger (pre-sorted) shows the key in the order in which they were added to the array. However, the object array is being replayed:

 (var: String in MyAssociativeArray) {/ Key is not seen in the order displayed by the debugger} 

The key returned in another order - the international hammer? My question is, how did the debugger know the order in which the keys were included, and can I access this knowledge at the time of the order when the array runs again? I want to iterate the object in the order in which they were added. Do I need to keep this key in my order, which was added to the objective array?

 [0] 22477◦25220◦20.1 [1] 22477◦25220◦20.6 [2] 22477◦25220◦20.8 [3] 22477◦25244◦55.1 k (j) 

Thanks

The debugger type lists your objects in an associative array, which you Searching for you (numerically and alphabetically sorted) make it easy to find. The list given in your example is sorted in such a way that it is a coincidence that you added items to the associative array in the same order.

There is no way to find the order by adding objects without additional metadata. If you need such a behavior then try to create a custom class for it.

Here's an example:

  import flash.utils.Dictionary; Import Flash. Import flash.utils.flash_proxy; Dynamic Class OrdaysAssociate Provides Proxy {Private var_items: Dictionary = New Dictionary (); Private var _idx: array = new array (); Namespace Flash_Proxy override Flash_procoxy function set property (name: *, value: *): zero {_items [name] = value; _idx.push (name); } Override Flash_prix function getProperty (name: *): * {returns_items [name]; } Override Flash_proxy functionNextNameIndex (index: int): int {return index> lt; _idx.length? Index + 1: 0; } Override Flash_Proxy function nextName (index: int): string {returns _idx [index-1]; } Override Flash_proxy function nextValue (index: int): * {Return_items [_idx [index-1]]; }}  

With the above you can do something like this:

  var assoArray: object = new order osaurus (); AssoArray ["key_one"] assoArray ["key_two"] = "value_two" assoArray ["key_three"] = "value_three" assoArray ["key_four"] = "value_four" (var item: assoArray string for each ) {Trace (item)}  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -