Solution for 1067: Implicit coercion of a value of type String to an unrelated type mx.core:IFactory

Got this error in Flex?

1067: Implicit coercion of a value of type String to an unrelated type mx.core:IFactory.

You tried the following type of thing in your MXML and it worked:

itemRenderer="com.example.MyItemRenderer"

But now you set it in actionscript and you get this error.

Solution:

item.itemRenderer = "new ClassFactory(MyItemRenderer);"

Header Renderer Example

In my case I had the following in my Flex 4.6 project and it was working fine:

<s:GridColumn dataField="banana" headerRenderer="com.example.ui.RotateGridHeaderRenderer" />

Then I changed the code and wanted to create the columns dynamically in actionscript, but the following options gave me the above error:

column.headerRenderer = RotateGridHeaderRenderer

column.headerRenderer = "com.example.ui.RotateGridHeaderRenderer"

the solution was as above,

column.headerRenderer = new ClassFactory(RotateGridHeaderRenderer);

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.