The code below doesn't compile for me. What are you trying to do? Just add extra text to each data's label?
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of aicfan4 Sent: Friday, March 21, 2008 12:15 AM To: [email protected] Subject: [flexcoders] Custom ItemRenderer in HorizontalList I'm trying to display a horizontal list of words in an AIR application. I'm creating a custom component for the ItemRenderer, and then am setting the HorizontalList's dataProvider to an array of strings. I can see the proper # of items are being added to the HorizontalList (the rollover mouse state is appearing for the appropriate number of items), but no text is displayed in the list. I'm tracing within the component and it's setting the text for each item properly, so I'm stumped. Anyone have any ideas? /* --- ListContainer.mxml --- */ <mx:Canvas ...> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; [Bindable] private words:ArrayCollection = new ArrayCollection(["bug", "show", "me", "the", "text"]); ]]> </mx:Script> <mx:HorizontalList width="100%" dataProvider="{words}" itemRenderer="MyRenderer" /> </mx:Canvas> /* === ListContainer.mxml === */ /* --- MyRenderer.as --- */ import mx.controls.Label; import mx.controls.listClasses.IListItemRenderer; import mx.core.IDataRenderer; import mx.core.UIComponent; public class MyRenderer extends UIComponent implements IDataRenderer, IListItemRenderer { protected var wordLabel:Label; private var _word:String; private var _wordChanged:Boolean; public function MyRenderer() { super(); _word = ""; _wordChanged = false; } override protected function commitProperties():void { super.commitProperties(); if(_wordChanged) { _wordChanged = false; wordLabel.text = _word; trace("wordLabel being set: " + wordLabel.text + " and is visible: " + wordLabel.visible); invalidateSize(); } } override protected function createChildren():void { super.createChildren(); if(!wordLabel) { wordLabel = new Label(); addChild(wordLabel); } } override protected function measure():void { super.measure(); measuredWidth = wordLabel.getExplicitOrMeasuredWidth(); measuredHeight = wordLabel.getExplicitOrMeasuredHeight(); } public function get data():Object { return _word; } public function set data(value:Object) { if(value is String) { _word = String(value); _wordChanged = true; invalidateProperties(); invalidateDisplayList(); } } } /* === MyRenderer.as === */

