Hi, I am working on code that is similar to this example, the difference is my arraycollection is a list of objects that I get from a web service call. I use a property of the object to check and uncheck the checkbox.It works fine but I get this warning: unable to bind to property(the property I use to check/unchk the checkbox) on class (class is not an IEventDispatcher). I have the arraycollection as a Bindable object, but is there anyway that I can use the object as it is and not get the warning.
Thanks. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2008/01/27/using-a-checkbox-control-as-a-list-item-renderer-in-flex/ --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:vo="*" layout="horizontal" verticalAlign="middle" backgroundColor="white" creationComplete="init();"> <mx:Script> <![CDATA[ import mx.events.CollectionEvent; import mx.utils.ObjectUtil; private function init():void { arrColl.dispatchEvent(new CollectionEvent (CollectionEvent.COLLECTION_CHANGE)); } private function arrColl_collectionChange (evt:CollectionEvent):void { try { var tArr:Array = arrColl.source.filter (selectedOnly); textArea.text = ObjectUtil.toString(tArr); lbl.text = tArr.length.toString() + " item(s) selected"; } catch (err:Error) { // ignore. } } private function selectedOnly(item:ListItemValueObject, idx:uint, arr:Array):Boolean { return item.isSelected; } ]]> </mx:Script> <mx:Array id="arr"> <vo:ListItemValueObject label="One" isSelected="Y" /> <vo:ListItemValueObject label="Two" isSelected="Y" /> <vo:ListItemValueObject label="Three" isSelected="Y" /> <vo:ListItemValueObject label="Seven" isSelected="N" /> </mx:Array> <mx:ArrayCollection id="arrColl" source="{arr}" collectionChange="arrColl_collectionChange(event);" /> <mx:Panel id="panel" title="Items" status="{arrColl.length} total" styleName="opaquePanel"> <mx:List id="list" dataProvider="{arrColl}" alternatingItemColors="[#EEEEEE, white]" width="150" rowCount="8"> <mx:itemRenderer> <mx:Component> <mx:CheckBox selected ="{(data.isSelected=='Y')? true:false}" click="{data.isSelected = (data.isSelected != 'Y') ? 'Y' : 'N';}" change="onChange(event);"> <mx:Script> <![CDATA[ private function onChange (evt:Event):void { trace(data.label + data.isSelected); } ]]> </mx:Script> </mx:CheckBox> </mx:Component> </mx:itemRenderer> </mx:List> <mx:ControlBar horizontalAlign="right"> <mx:Label id="lbl" /> </mx:ControlBar> </mx:Panel> <mx:TextArea id="textArea" verticalScrollPolicy="on" width="100%" height="{panel.height}" /> </mx:Application> -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/flex_india?hl=.

