package AddrList { import flash.events.Event; import flash.events.MouseEvent; import mx.collections.ArrayCollection; import mx.controls.AdvancedDataGrid; import mx.controls.CheckBox; import mx.controls.advancedDataGridClasses.AdvancedDataGridGroupItemRenderer; public class AdvancedDataGridGroupItemRendererEx extends AdvancedDataGridGroupItemRenderer { private var checkBox : CheckBox; public function AdvancedDataGridGroupItemRendererEx() { super(); } override protected function createChildren():void { super.createChildren(); checkBox=new CheckBox(); checkBox.addEventListener(MouseEvent.CLICK,onChange); checkBox.x = 4; checkBox.y=label.y + 8; addChild(checkBox); } protected function onChange(e:MouseEvent):void { e.stopPropagation(); var cbx:CheckBox = e.currentTarget as CheckBox; var a:ArrayCollection = this.data.children as ArrayCollection; for(var i:int =0;i<a.length;i++) { a[i].checked = cbx.selected; } data.selectedState = cbx.selected; var d:AdvancedDataGrid = this.owner as AdvancedDataGrid; d.invalidateList(); } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); if (disclosureIcon) { disclosureIcon.x=disclosureIcon.x + 20; } if (icon) { icon.x=icon.x + 20; } label.x=label.x + 20; checkBox.selected = data.selectedState; } } }