-
1. Re: ItemRenderer depending on other variable than data
Claudiu Ursica Mar 16, 2011 3:04 AM (in response to eprevot123)Most likely your combobox is either not created yet or the selectedItem is not
set.
C
-
2. Re: ItemRenderer depending on other variable than data
eprevot123 Mar 16, 2011 3:10 AM (in response to Claudiu Ursica)The method where I set the itemRenderer with its properties is called on the "change" event of the comboBox, so yes the comboBox is created and the selectedItem is set.
And event if I comment the "factory.properties = ..." and set a default value to the firstLetter in the CustomTreeRenderer, I get this error.
-
3. Re: ItemRenderer depending on other variable than data
Claudiu Ursica Mar 16, 2011 3:25 AM (in response to eprevot123)Can you show some more code?
C
-
4. Re: ItemRenderer depending on other variable than data
eprevot123 Mar 16, 2011 4:08 AM (in response to eprevot123)I don't know if it's the best solution or if it works for all usecases but it's possible to use the "outerDocument" variable to get the variable from the mxml where the Tree is :
<mx:Tree >
<mx:itemRenderer>
<fx:Component>
<mx:TreeItemRenderer color="{(outerDocument.firstLetter == data.charAt(0)) ? 0xFF0000 : 0x000000}"/>
</fx:Component>
</mx:itemRenderer></mx:Tree>
See http://www.adobe.com/devnet/flex/articles/itemrenderers_pt1.html


