开发者

ActionScript 3.0 list listener?

开发者 https://www.devze.com 2023-02-06 16:54 出处:网络
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 rowIf it\'s an M

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

精彩评论

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