Hi,
I want a custom tree item renderer that consists of a basic TreeItemRenderer(to
reuse its
tree node icons) and several other standard controls(they are also
IListItemRenderer
implementors). Let's call it ComboTreeItemRenderer, and to simplify the
matters, assume
it is composed of a TreeItemRenderer and a Label.
This is my first try:
<mx:Tree width="100%" height="100%"
id="tagTree"
dataProvider="{myTags}"
change="handleTagSelection(event);">
<mx:itemRenderer>
<mx:Component>
<mx:HBox>
<mx:TreeItemRenderer>
</mx:TreeItemRenderer>
<mx:Label
text="[EMAIL PROTECTED]">
</mx:Label>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:Tree>
And the first error I met:
"Could not resolve <mx:TreeItemRenderer> to a component implementation."
I don't believe TreeItemRenderer can not be used in mxml coding, so I guess I
was just not
coding in the right way. But what's the right way then?
However, that's not really what I was stumped by, since I found that I could
write a custom
component(named MyTreeItemRenderer) which extends TreeItemRenderer(nothing to
override, just to work around the "could no resolve" error), and it could be
resolved of
course. So here is my second try:
<mx:Tree width="100%" height="100%"
id="tagTree"
dataProvider="{myTags}"
change="handleTagSelection(event);">
<mx:itemRenderer>
<mx:Component>
<mx:HBox>
<mx:MyTreeItemRenderer>
</mx:MyTreeItemRenderer>
<mx:Label
text="[EMAIL PROTECTED]">
</mx:Label>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:Tree>
Now comes the really difficulties: I know I must assign values to some
properties of
MyTreeItemRenderer using information carried by data and listData, but what
properties
to assign value to? And what makes me even crazier is that I found neither
listData and
data was set(observed by overriding set listData and set data functions and
find they were
never called).
Looking forward to seeing helpful hints. Thanks in advance.