4,328
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
<mx:Script>
<![CDATA[
[Bindable]
private var dp:Array = [{name:"John Smith", foo:"bar"},
{name:"Ellen Smith", foo:"baz"},
{name:"James Smith", foo:"eggs"},
{name:"Jane Smith", foo:"spam"}]
public function init():void{
this.addEventListener(MouseEvent.MOUSE_DOWN,getItem);
}
private function editEnd(event:Event):void
{
trace(listImpl.selectedItem.foo+'----'+listImpl.selectedItem.name);
}
private function setEditor():void
{
listImpl.editedItemPosition = {columnIndex:0,rowIndex:2};
}
public function getItem(event:MouseEvent):void
{
trace("========被选中了===========");
}
]]>
</mx:Script>
<mx:Button click="setEditor()"/>
<mx:List y="30" width="200" selectedIndex="6" id="listImpl"
selectionColor="#CCCCFF" labelField="name"
dataProvider="{dp}" editable="true"
itemEditBegin="trace(listImpl.editedItemPosition.columnIndex)"
itemEditEnd="editEnd(event)" editorXOffset="5"
editorYOffset="2"/>
</mx:Canvas>
</mx:Application>