<mx:VBoxxmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="50" implements="mx.controls.listClasses.IDropInListItemRenderer"> <mx:Script> <![CDATA[ import mx.controls.DataGrid; import mx.controls.List; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.listClasses.BaseListData; // store the list data item in case we want to do something with it // later on privatevar _listData:BaseListData; [Bindable("dataChange")] // a getter method. publicfunction get listData():BaseListData { return _listData; } // a setter method,当BaseListData 数据被传入之后renderer 就可以通过它自己的一 //些属性访问拥有它的父组件中元素的数据,甚至可以调用父组件中的方法。 publicfunction set listData(value:BaseListData):void { _listData = value; if (value.owner is DataGridColumn) { trace("DataGridColumn"); } elseif(value.owner is List) { trace("List"); } elseif (value.owner is CustomDataGrid) { trace("CustomDataGrid"); (value.owner as CustomDataGrid).checkInMethod(this); } } override publicfunction set data(value:Object):void { nameTxt.text = value.name; appearanceTxt.text = value.appearance; }