R – flex 3 and using name/value pairs

actionscript-3apache-flex

Does anyone have any recommendations for working with name/value pairs in Flex?

Context:
I want to create a Flex UI for updating a database table. I want the UI to contain the field name(read only) and current field value (which will be editable). Im using the WebService component to retrieve the field value and then asssigning it to an object with the field name hardcoded e.g.

private function resultHandler(event:ResultEvent):Object
{
var resultsObj:Object;
resultsObj = {
name:event.result.name as String,

This approach however is adding the dependency that the table structure/field names will never change. Using the object type also requries that i write my own algorithm to sort the output.

Best Answer

I'm not sure I understand the issue.

If you want to avoid dependency of the properties returned from the event at this point, simply use the event.result object, which is already an associative array.

As for sorting, we would need more context on what you are attempting to sort.

Related Topic