This content has been marked as final. Show 3 replies
I dont believe the valueOf() function takes parameters.
What I would do is...
var myArray:Array = new Array();
var item:Object = new Object();
item.DeptID = 1;
var item2:Object = new Object();
item2.DeptID = 2;
var item3:Object = new Object();
item3.DeptID = 3;
var item4:Object = new Object();
item4.DeptID = 4;
var myArrayCollection:ArrayCollection = new ArrayCollection(myArray);
function displayID(item:*, index:int, arr:Array):void
When accessing values you want the data inside the ArrayCollection, not the ArrayCollection itself. That is why you are getting errors. So get ahold of the data inside the ArrayCollection and do your processing on that.
Hope this helps you out.
If you have a string variable containing the name of the property yu want to access, you can use bracket notation, like this:
var sPropertyName:String = "DeptID";
Alert.show(acDept [ sPropertyName ] ); //assuming deptID is a string or number.
(the extra spaces around the brackets are to keep this forum from misinterpreting them.)
And oops, as Art says, you need to do that with the individual collection elements, not the AC itself. Sorry for the too-quick response.