I can easily do this in ColdFusion but can't figure it out in FLEX.

I have a database table containing settings for an application.  The
table has a "Name" field for the name of a declared variable in my
MXML application and a "Value" field for the initial variable
assignment.  For example, the result returned from a remote object
call to the table returns 2 records: 

rs[0].NAME = "pg1Title", rs[0].VALUE = "Page 1 Title"
rs[1].NAME = "pg2Title", rs[1].VALUE = "Page 2 Title"

In my application MXML I have declared 2 variables:
public var pg1Title:String = "";
public var pg2Title:String = "";

In the result event for the remote object call, I want to loop thru
the results and assign each declared variable the VALUE from the
result set associated with the NAME field (which matches the declared
variable's name).

private function onResult(e:ResultEvent):void{
  var n:ArrayCollection = e.result as ArrayCollection;
  for(var i:uint=0;i<n.length;i++){
   // THIS DOESN'T WORK; HOW DO I REFERENCE THE VARIABLE
   Object(rs.getItemAt(i).NAME) == rs.getItemAt(i).VALUE; 
  }
}

How can I reference the declared variables so if a declared variable's
name matches the result set's NAME field, the variable will be
assigned the result set's VALUE?

For the first record in the result set I want to assign variable
pg1Title the string "Page 1 Title".


Thanks...


Reply via email to