The code you're trying for issue #1 doesn't work because  your
collection is holding formField instances, not just IDs. To retrieve
an item with a specific id you could do this:

function getFieldByID(idToFind:Number):FormField
{
   for each(var ff:FormField in callLabelCollection)
   {
      if(ff.callLocation_id == idToFind)
         return ff;
   }
   return null;
}

Not sure I completely understand issue #2 but you can always use
addItem() to add items to an ArrayCollection.

HTH,
Ben


--- In flexcoders@yahoogroups.com, "donvoltz" <[EMAIL PROTECTED]> wrote:
>
> Hi Ben or anyone else who would like to help,
> 
> I tried to incorporate your suggestions, but I think I still am
> missing the whole idea about an array collection. 
> 
> in one part of my code, I have done the following
> 
> for each (var item:XML in locationData){
> var ff:formField = new formField();
> ff.labelText = item..callLocation_DisplayName;
> ff.callLocationId = item..callLocation_id;
> ff.allowableDataFlag = item..deptCategory;
> ff.callSelectedDate = mysqlDate.format(calendarSelector.selectedDate);
> callLabelCollection.addItem(ff);
> addChild(ff);
> }
> 
> This runs through the loop a total of 16 times to build my array
> collection.
> 
> Now in a custom event handler, when the user selects a given date, I
> query a new table to determine who is scheduled in any of these 16
> locations on the selected date.
> 
> What I need to do now is to set another parameter of the custom
> component based on the callLocationId that I set in my array collection.
> 
> So for this I have 2 questions
> 
> 1) how do I access the array at a given callLocationId from the array
> collection above?
> 
> for this I have tried
> 
> var someFF:formField =
> callLabelCollection.getItemIndex(item..callLocation_id) as formField;
> 
> but am not getting any results
> 
> and 
> 
> 2) how do I now add additional fields to this array to the array
> collection?
> 
> 
> Thanks for any help 
> 
> Don
>


Reply via email to