Action Script Array Question

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default Action Script Array Question

    Hi,
    Is there an object in ActionScript which will behave something like a
    java.util.HashMap ? I am trying to store some data into an array using


    var myArray:Array=new Array();

    myArray.push(strKey,Object);


    I am storing multiple keys object pairs this way, but now I am wondering how
    to get the object from the array using the key like with a hashmap? Can I do
    something like

    Object obj = myArray.get(strKey);


    I am trying to avoid looping through the array.

    Thanks for any advice.

    javawebgrrl Guest

  2. Similar Questions and Discussions

    1. CF Grid / Java Script / Action Script
      Hi, Does anyone know of a good reference for the attributes CFgrid exposes in a flash form? eg. I would like to select the first row on load. ...
    2. action script help
      im trying to load an external swf file using the gotoAndPlay(_root.emptyClip.loadMovie("grey_bars.swf")); is it possible to load the same movie...
    3. Action script??!!?!
      HI, Im kinda new to this action script stuff and a friend of mine gave me some code a while back to look at. Basically its a menu system with...
    4. Action Script Sound Object vs Drag-on-stage question
      Until recently, I have always been a 'drag the sound on stage' designer. All the current reading I have done, however, seem to encourage going the...
    5. Need Help with action script.
      I am working on a project for one of my classes, and in it I want to be able to click on an apple (which is a button) and make it fall. I have tried...
  3. #2

    Default Re: Action Script Array Question

    I don't think something like that exists in ActionScript.

    You could write your own class that would do same thing as HashMap. But
    you'll need to do looping anyway, internally. Externally it would behave as a
    normal java HashMap.

    theShtorm Guest

  4. #3

    Default Re: Action Script Array Question

    Thank you very much for your reply. In case anyone was interested in this
    topic . . .
    I was able to code what I needed using the generic Flex Object as follows:

    Put actionscript object named "theObject" into Flex Object named "map"
    var map:Object = new Object();
    map[strKey] = theObject;

    get the object from the map using the key.
    theObject = map[strKey];


    javawebgrrl Guest

  5. #4

    Default Re: Action Script Array Question

    You figured it out. That is what is called an "associative array". It was a new concept for me, but is very useful. I just have to assume that it is optimized for for access.

    Tracy
    ntsiii Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139