This may be an obvious search, but I'm not totally sure on the proper syntax... basically what I want to do is:
private function makeISchedule(data:Array, label:String = null):ArrayCollection{
var arr:ArrayCollection = new ArrayCollection;
for (var i:int = 0; i<data.length; i++){
var isched:SimpleScheduleEntry = new SimpleScheduleEntry;
isched.startDate = dater.parseString( data[i].DateTime );
isched.endDate = dater.parseString( data[i].EndDateTime );
if (label != null){
isched.label = data[i].label;
}
arr.addItem( isched );
}
return arr;
}
the problem is .label.. it looks for the actual 'label' field rather than using the label string that's been passed to the function. How can I get the 'label' to be read as the argument variable?