Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

ItemRenderer declaration in MXML

$
0
0
Hello,

I'm building a custom component with an itemRenderer public property :

public function get itemRenderer():IFactory

return _itemRenderer;

public function set itemRenderer(value:IFactory):void

_itemRenderer = value;
.....

So the setter is waiting for an IFactory.

In MXML, for components like spark List or Datagrid, the itemRenderer
property can be set with the following declaration :
itemRenderer="com.foo.ItemRenderClass"

I would like to understand the mechanism that allow the conversion of the
String into an IFactory.
I guess the compiler checks if com.foo.ItemRenderClass exists and, if true,
returns a new ClassFactory(ItemRenderClass) ?

Is it possible to get the same behavior with a custom component, I mean
having the possibility to use a classPath String in MXML while the setter of
the property is waiting for a different type (like an Ifactory in my case) ?
is it based on Metadata ?

Thank you.

Viewing all articles
Browse latest Browse all 5648

Trending Articles