I was wondering if somone could help me with a cell renderer for a list. Basically, I am trying to create a multi-select list where the user would simply click to select or not select an item. I have set the selectable attribute to false for the list and am using a custom renderer with a mouseDown event. Then, if the option is selected, I set the background color of cell renderer. everything works fine, but the cell renderer seems to repeat itself, meaning if the list scrolls and one of the selections are highlighted, then the corresponding row on the next "page" is also highlighted. For example, if the list shows 5 rows and you select row 1, then row 6 will also be highlighted. I've listed the code bellow. If someone could help me avoid this behavior, it would be much apprecited.
Thank you, Sean <mx:HBox xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns:customFields="com.he.view.components.form.customFields.*" mouseDown="onClick()" height="100%" width="100%" hScrollPolicy="off" vScrollPolicy="off" verticalAlign="middle" borderStyle="none" backgroundAlpha="0"> <mx:Script> <![CDATA[ import mx.styles.*; import com.he.vo.TopicVO; var listOwner : Object; // the reference we receive to the list var getCellIndex : Function; // the function we receive from the list var getDataLabel : Function; // the function we receive from the list var selectedItem:TopicVO; private var selected:Boolean = false; private var selectedStyle:CSSStyleDeclaration; private var unselectedStyle:CSSStyleDeclaration; public function setValue(str:String, item:Object):Void { selectedItem = new TopicVO(item); if (item == undefined) { visible = false; return; }else{ visible = true; } } private function onClick() { var index:Number = getCellIndex().itemIndex; selected = ! selected if (selected) { this.setStyle('backgroundColor','#FFD478'); listOwner.dispatchEvent({type:"itemSelected", target:listOwner, index:index}); } else { this.setStyle('backgroundColor','#FFFFFF'); listOwner.dispatchEvent({type:"itemUnselected", target:listOwner, index:index}); } } ]]> </mx:Script> <mx:Image source="{selectedItem.IMAGE.THUMBURL}" height="35" width="35" mouseDown="onClick()" /> <mx:Label text="{selectedItem.TOPICNAME}" height="35"/> </mx:HBox> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

