Yes, you need to use ClassFactory.  Search the archives for examples.

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Ethan Miller
Sent: Thursday, June 12, 2008 2:37 PM
To: [email protected]
Subject: [flexcoders] Assigning ItemRenderers in AS vs MXML

 

Greetings -

The following mxml works fine:

<mx:DataGridColumn
id="peopleColumn"
headerText="{AdvisorModel.getInstance().selectedQuestionList.getItemAt(0
).Label}" 
itemRenderer="Apps.Advisor.Shared.IR_People"/>

However this AS (part of a dynamic dataGrid creation) which attempts to
do the 
same as the mxml above fails reporting that it annot coerce "IR_People"
to 
mx.Core.IFactory:

dgc = new DataGridColumn(); 
dgc.headerText = oColumnDef.headerText 
var ir:IR_People = new IR_People); 
dgc.itemRenderer = ir; 

(the above is part of a function the rest of which is working fine).

Something special about creating itemRenderers in AS?

cheers, ethan

 

Reply via email to