Spark
Spark

Reputation: 672

How to assign a item render dynamically in flex?

I want to change a list's item render with code like this:

booklist.itemRenderer = BookItemRender;

BookItemRender is a subclass of s:ItemRenderer.

It report error:

1067: Implicit coercion of a value of type Class to an unrelated type 

How to correctly specify a itemRender in code?

Upvotes: 1

Views: 189

Answers (1)

dtuckernet
dtuckernet

Reputation: 7895

You have to specify a ClassFactory instance for this:

booklist.itemRenderer = new ClassFactory(BookItemRender);

Upvotes: 3

Related Questions