3 Replies Latest reply on Jan 18, 2010 8:14 AM by George Donn

    Array Collection

    George Donn

      I am trying to use an array collection to only grab title and time information - almost like when one tries to retrieve a specific node in xml and store it in a collection. My arraycollection is gathering the data but I do not know how to spit out only time and title infomation from the array object.



      I also attached a picture to also view the data which I am trying to retrieve into a datagrid - if it helps.




      Thanks I appreciate any help and advice,


        • 1. Re: Array Collection
          PeakDigital Level 1

          If I am following you correctly, you would access it like this:




          0 accessing the first cuePoint, 1 the second, etc. Loop through with an integer variable to collect, or you *might* be able to set your DataGrid's dataProvider to infoObject.cuePoints (haven't tried that, not sure if it would work) and set the grid's column sources to match the names in the ArrayCollection.

          • 2. Re: Array Collection
            archemedia Level 4

            the data structure of you infoObject is not ideal! cuePoints is an array containing arrays. It should be an Array (or even better, an ArrayCollection) of Objects or Class instances. That way, you can easily create your dataGrid:



            <mx:DataGrid dataProvider="{infoObject.cuePoints}">


                 <mx:DataGridColumn dataField="time"/>

                 <mx:DataGridColumn dataField="type"/>




            My suggestion is to create a class CuePoint and to add instances of this class to your cuePoints Array.



            • 3. Re: Array Collection
              George Donn Level 1

              This works very well - I was making it much harder than what it it needed to be. I just created an array list and did the data grid like above.

              myCuePointData = neew ArrayList(infoObject.cuePoints);