> Generic form>>
> var item:String = xmlLC.getItemAt(i).collectionID; ??
> 

Try this

var item:String = xmlLC.getItemAt(i)["collectionID"];




--- In [email protected], Angelo Anolin <angelo_ano...@...> wrote:
>
> Actually, the dpID is different for each xmllistcollection being passed.
> 
> For example, for an xmllistcollection consisting of Orders, I might have to 
> need the OrderID, which I am accessing, and it goes on for another 
> xmllistcollection of States, where on that collection, I might have to access 
> StatesID.
> 
> To give further clarification,
> 
> say I have two combo boxes, cmbTeams and cmbCoach.  the dataprovider for 
> cmbTeams is xmllcTeams and for cmbCoach is xmllcCoach.
> 
> I want a generic function such that I would be able to set the selectedItem 
> for each Combo Box instead of writing two.
> 
> private function SetComboBoxSelectedItem(itemToSelect:String, 
> xmlLC:XMLListCollection, cmb:ComboBox, collectionID:String)
> 
> Since the collectionID for the xmllcTeams is TeamID, then that is the value 
> which I pass as collectionID in the function.  For the xmllcCoach, it would 
> be the CoachID.
> 
> 
> so what comes now is that when I want to call the function, the collectionID 
> is represented by the actual ID which to match in the data provider.
> 
> For the xmllcTeams
> var item:String = xmlLC.getItemAt(i).TeamID
> 
> For the xmllcCoach
> var item:String = xmlLC.getItemAt(i).CoachID
> 
> 
> Generic form>>
> var item:String = xmlLC.getItemAt(i).collectionID; ??
> 
> Thanks.
> 
> 
> 
> ________________________________
> From: gareth_arch <gareth_a...@...>
> To: [email protected]
> Sent: Wed, 19 May, 2010 10:34:35
> Subject: [flexcoders] Re: Generic Function To Set ComboBox Item
> 
>   
> Don't you access properties in an XMLListCollection differently than in an 
> ArrayCollection?
> 
> So rather than...
> var item:String = dataProv.getItemAt(i).dpID;
> it would be
> var item:String = dataProv.getItemAt(i)....@dpid;
> 
> Try doing a debug of your code and see what is being returned also.
> 
> --- In [email protected], Angelo Anolin <angelo_anolin@> wrote:
> >
> > Hi FlexCoders,
> > 
> > I would want to create a generic function to be able to set a ComboBox item.
> > 
> > The function I have goes like this:
> > 
> > private function selectComboItem(itemID:String, dataProv:XMLListCollection, 
> > cmb:ComboBox, dpID:String) :void
> > {
> >   for (var i:int = 0; i< dataProv.length; i++)
> >   {
> >     var item:String = dataProv.getItemAt(i).dpID;
> > 
> >     if(itemID == item)
> >     {
> >       cmb.selectedIndex = i;
> >       break;
> >     }
> >   }
> > }
> > 
> > dpID is the data item in the XML List collection which should match the 
> > passed itemID.  But I can't seem to get properly the item.
> > 
> > Any suggestions highly appreciated. Thanks.
> >
>


Reply via email to