1 Reply Latest reply on Mar 12, 2010 6:08 AM by levancho

    Array or ArrayCollection

    JockMahon Level 1

      Should i always use arrayCollection instead of an array or is it some times better to use an array


      for example in the case where i just want a collection of values and i know that i wont have to do any sorting or anything else for example its just been used to send data to a remote service like cf


      Also is it bad practice to use the Object data type

      so for example if i want to pass data to cf and i want to pass an id and a collection of sub ids


      so i would create a Object



      var myObj:Object = new Object();


      myObject["cartID"] = 8;

      myObject["cartItems"] = new Array()


      i know some of u will suggest creating a VO but to me this seams like such overkill

        • 1. Re: Array or ArrayCollection
          levancho Level 3

          ArrayCollection is more expensive than Array, and BTW you can do sorting on Array too,

          if you do not want Events when items in array change,fancy cursor serching etc ..  I would definately stay away from ArrayCollection simply because its just a wrapper around Array, anyways so you may as well use Array directly.


          but when you deal with RemoteObjects etc ... most of the times yo will have to deal with ArrayCollections.

          1 person found this helpful