Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 582413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:41:03+00:00 2026-05-13T14:41:03+00:00

I have an array of objects which uses a delimited string as the keys.

  • 0

I have an array of objects which uses a delimited string as the keys. When examined in the FB4 debugger, 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 (cast to string) but the third item in the multi-part delimited key is naturally a string — it’s like an alphanumeric library shelf reference. As expected, when you click on the [+] icon in the debugger, you can view the object associated with that string key. So far so good.

The debugger shows the keys in the (pre-sorted) order in which they were added to the array. However, when iterating the object array so:

    for (var key: String in MyAssociativeArray){
          // keys are visited not in the order displayed by the debugger
    }

the keys are returned in some other order –internal hash? My question is, how does the debugger know the order the keys were added in, and can I access that knowledge at runtime when iterating the array? I want to iterate the objects in the order in which they were added. Or do I need to maintain my own index of these keys showing the order they were added to the associative array?

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

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:41:03+00:00Added an answer on May 13, 2026 at 2:41 pm

    The debugger sorts lists of items in an associative array lexicographically for you (ordered numerically and alphabetically) to make it easier to find what you’re looking for. The list in your example is sorted this way. It’s a coincidence that you added items to the associative array in the same order.

    There is no way for you to discover the order in which you add items to an associative array without creating additional metadata. If you need such behavior try creating a custom class for this.

    Here’s an example:

    import flash.utils.Dictionary;
    import flash.utils.Proxy;
    import flash.utils.flash_proxy;
    
    
    dynamic class OrderedAssoArray extends Proxy{
        private var _items:Dictionary = new Dictionary();
        private var _idx:Array = new Array();
        use namespace flash_proxy
        override flash_proxy function setProperty(name:*, value:*):void {       
            _items[name] = value;
            _idx.push(name);
        }
        override flash_proxy function getProperty(name:*) : *{      
            return _items[name];
        }
        override flash_proxy function nextNameIndex (index:int):int {       
            return index < _idx.length ? index + 1 : 0;     
        }
        override flash_proxy function nextName(index:int):String {      
            return _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 OrderedAssoArray();
            assoArray["key_one"] = "value_one"          
            assoArray["key_two"] = "value_two"
            assoArray["key_three"] = "value_three"
            assoArray["key_four"] = "value_four"
            for each(var item:String in assoArray){
                trace(item)
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have followed this tutorial which uses jQuery UI to generate Facebook tokens like:
I have an array of DataRow objects in my C# project which I would
I have an array of Deferred objects, which I'm trying to map to their
I have a method which returns an array of fixed type objects (let's say
I have array which gets from session, this is print_r of array print_r($_SESSION['wpsc_cart']); wpsc_cart
I have the following code which uses one of the JTextAreas from an array
I have an array of Ember.Object s which is displayed by Handlebars {{#each}} helper
I have an object which im converting into an array of coords which will
I have created an empty json object having an array itemlist(which further contains itemid
When I have array of objects, when I type the name of variable in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.