Hello, I'm testing with the VirtualComboBox, specifically I want to assign one itemrenderer or another, depending on the value of a property. I have tried, without success:
- Add a className when setting the property: In this case, I define the IItemRenderer inside a known CSS class: .itemrenderertruncate{ IItemRenderer: ClassReference("org.apache.royale.community.itemRenderers.LabelTruncateItemRenderer"); } In control, itemRendererTruncateByDefault property: private var _itemRendererTruncateByDefault:Boolean=false; public function set itemRendererTruncateByDefault(value:Boolean):void { _itemRendererTruncateByDefault = value; // The pseudo-class css itemrenderertruncate has the IItemRenderer assigned to it. // It adds the css selector but does not recognise the IItemRenderer assigned by ClassReference. if(value) addClass('itemrenderertruncate'); } - Set the as3 class directly (I override loadBeads to set it before the IBeadView loads) override protected function loadBeads():void { // We must assign the itemRenderer to the control before loading the IBeadView bead. // At first it assigns the correct itemRenderer, but then it does not recognise it and sets the default itemRenderer, why? // (After this instruction, it has been verified that the itemRenderer is never set again). if(_itemRendererTruncateByDefault) { itemRenderer = new ClassFactory(LabelTruncateItemRenderer); // Test: is ok --> var it:Object = itemRenderer.newInstance(); it is LabelTruncateItemRenderer } super.loadBeads(); } What am I doing wrong? Thx Hiedra