views:

34

answers:

1

I create a new object. My new object will always have a labelField because it has to be added to a dataProvider in a ComboBox. The problem is my next property. Each object in the dataProvider has a dataField property that has a string value [eg: 'code' or 'isoCode']. What I want to be able to do is this:

var myObject:Object = new Object;                 // functional
var myOtherObject:Object = new Object;            // functional

myOtherObject[dataField] = "code";                // functional

myObject[labelField] = "Hi";                      // functional
myObject[myOtherObject[dataField].value] = "ALL"; // not functional

Any help would be appreciated.

+2  A: 

Try this:

var myObject:Object = new Object();
var myOtherObject:Object = new Object();

myOtherObject.dataField = "code";

myObject.labelField = "Hi";
myObject[myOtherObject.dataField] = "ALL";
elmonty