开发者

ActionScript 3.0 list listener?

In ActionScript 3.0, I have code that displays a list. When a row is selected, how开发者_高级运维 do I add a listener to execute code and how do I extract the position of the selected row


If it's an MX list:

To add the event listener:

list.addEventListener(ListEvent.ITEM_CLICK, onListItemClick);

To get the selected row:

public function onListItemClick(le:ListEvent):void
{
  var selectedItem:int = le.rowIndex;
}


if it's a FL list:

To add the event listener:

list.addEventListener(Event.CHANGE, onListItemChange);

To get the selected row:

public function onListItemChange(e:Event):void
{
  var selectedIndex:int = list.selectedIndex;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜