当鼠标位于List组件上时如何显示手形光标?

时间:2010-05-24 06:58:52

标签: flex flex3

我知道后面会显示一个手形光标:

component.mouseChildren = true;
component.useHandCursor = true;
component.buttonMode = true;

当我在List组件上执行上述操作时,会显示手形按钮,整个组件会失去它的交互性(手形光标甚至会显示在滚动条上)。

那么在滚动列表项时如何显示手形光标

3 个答案:

答案 0 :(得分:6)

错过了您的完整测试,下面是如何在任何Flex控件上显示手形光标。

我建议您创建一个自定义的itemRenderer,并为每个渲染器使用这些控件,只有当您在itemRenderer上时它才会显示,并且它不适用于整个List控件......


查看我写的关于在任何Flex控件上显示手形光标的博文。

Showing hand cursor on any Flex Control

有时useHandCursor=true buttonMode=true就足够了,但对于某些控件,您必须使用mouseChildren=false

示例:

<mx:Button label="Button" useHandCursor="true" buttonMode="true" />

<mx:Label text="Label" useHandCursor="true" buttonMode="true" mouseChildren="false"/>

答案 1 :(得分:1)

将手形光标放在数据网格上时遇到了同样的问题。我假设列表的解决方案是相同的。

我发现获取手形光标同时与数据网格中的项目具有交互性的方式是使用DataGrid的itemRollOver和itemRollOut事件(List也有它们):

[Embed("../assets/images/cursors/hand_cursor.png")]
private var handCursor:Class;

protected function grid_itemRollOver():void {
    cursorManager.setCursor(handCursor);
}

protected function grid_itemRollOut():void {
    cursorManager.removeAllCursors();
}

答案 2 :(得分:0)

function meOver(evt:Event):void{
    evt.target.useHandCursor = true;
}

myList.addEventListener(MouseEvent.MOUSE_OVER, meOver);
相关问题