我遇到了一些问题,试图使用ActionScript 3.0来获取当前正在使用ActionScript 3.0在flash的datagrid组件上悬停opon的行的索引。
那么请问如何在AS3中获取鼠标翻转时数据网格的行索引。
由于
答案 0 :(得分:1)
您使用ListEvent.ITEM_ROLL_OVER
事件而不是基本鼠标
import fl.events.ListEvent;
var sampleItem1:Object = { Name:"John Alpha", Number:"555-123-0101", Email:"jalpha@fictitious.com" };
var sampleItem2:Object = { Name:"Mary Bravo", Number:"555-372-3322", Email:"mbravo@fictitious.com" };
var sampleItem3:Object = { Name:"Trevor Gamma", Number:"555-485-1212", Email:"tgamma@fictitious.com" };
var sampleItem4:Object = { Name:"Susan Delta", Number:"555-987-3434", Email:"sdelta@fictitious.com" };
dg.columns = ["Name","Number","Email"];
dg.addItem(sampleItem1);
dg.addItem(sampleItem2);
dg.addItem(sampleItem3);
dg.addItem(sampleItem4);
function gridRollOver(e:ListEvent):void
{
trace("rowIndex: " + e.rowIndex + " columnIndex: " + e.columnIndex);
}
dg.addEventListener(ListEvent.ITEM_ROLL_OVER, gridRollOver);