I guess the best way of handling this would be to have a generic itemRenderer and load the corresponding components inside it, depending on a data value passed to the List dataProvider.
That's how i would do it.
 
You can also do it in the List container via actionScript if you want, by setting your itemRenderer depending on your var :
if (var == A)
myList.itemRenderer = new ClassFactory(com.yoursite.itemRendererA);
 
Best,
Jean-Luc.
 
----- Original Message -----
Sent: Wednesday, July 12, 2006 2:28 PM
Subject: [flexcoders] Dynamic ItemRenderer


Hi,

I would like to use the List component with different type of data in
its dataProvider and adapt each itemRenderer depending on the type of
the data item :

var dp: Array = [new A(), new B()]
...
<mx:List dataProvider="{dp}" ... />

How can I use a "AItemRenderer" to handle A data type elements and
"BItemRenderer" to handle B data type elements ?

Thanks,

--
David Rousselie

********************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de
ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite.
Tout message electronique est susceptible d'alteration. Le Groupe France Telecom decline toute responsabilite au titre de
ce message s'il a ete altere, deforme ou falsifie.
Si vous n'etes pas destinataire de ce message, merci de le detruire immediatement et d'avertir l'expediteur.
*********************************
This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised
use or dissemination is prohibited.
Messages are susceptible to alteration. France Telecom Group shall not be liable for the message if altered, changed or
falsified.
If you are not the intended addressee of this message, please cancel it immediately and inform the sender.
********************************

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





YAHOO! GROUPS LINKS




__,_._,___

Reply via email to