Search code examples
phpapache-flexflex4flash-builderdataservice

How to manipulate data returned from PHP service in Flash Builder


I'm using the data/services in Flash Builder 4 to access the php functions of a site within an Air based Crud, and figuring out the most efficient ways to work with the data objects that come back.

   protected function getAllListResult_resultHandler(event:ResultEvent):void
        {
            allContacts = event.result as ArrayCollection;
        }

The data comes back as an associative array, which is fine if I want everything from it to be treated the same. But I'm not sure how I am supposed to pull a particular column from the array without having to go through a for loop to parse through it .. since right now the contact name would be at allContacts[i].name.

Basically I want to make a list of the names from the allContacts, so I want an array of allContacts[i].name to set as the data provider for a element. Is there any way to get that done without having to write a for loop to convert it into a new array or writing a new php function?


Solution

  • Many components (List, ComboBox etc.) have the property labelField. It's better to bind the whole arraycollection as data provider, than use the labelField property to display only the desired column