我和我的两个同学一起工作,我们希望能够将光标拖到tilelist上以选择多个tile。我们真的找不到任何能做到这一点的功能,是否有可能做到这一点?
祝你好运
由于
答案 0 :(得分:0)
这可以让您了解您想要完成的任务:
tileList = new TileList();
tileList.allowMultipleSelection = true;
tileList.addEventListener(MouseEvent.MOUSE_DOWN, startSelecting);
tileList.addEventListener(MouseEvent.MOUSE_UP, stopSelecting);
function startSelecting(e:MouseEvent):void
{
tileList.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
if (CellRenderer(e.target))
{
CellRenderer(e.target).selected = true;
}
}
function onMouseMove(e:MouseEvent):void
{
if (CellRenderer(e.target))
{
CellRenderer(e.target).selected = true;
}
}
function stopSelecting(e:MouseEvent):void
{
tileList.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
}
您肯定希望自定义它以满足您的需求,但基本上它会向磁贴列表中添加一些鼠标事件监听器,并选择在按下鼠标按钮时已翻转的任何磁贴。