Flex 3:当鼠标悬停在文本输入上时,如何更改鼠标光标?

发布于 2024-07-17 02:49:21 字数 617 浏览 7 评论 0原文

在 Flex 中,默认情况下,当您将鼠标悬停在文本输入上时,鼠标光标将更改为标准 I 十字栏。 如何更改此光标,以便显示常规鼠标指针光标而不是 I 十字栏?

更新:嗯,根据这篇博客文章,Flex 4 中的这个过程似乎非常简单: http://blog.flexexamples.com/2008/11/03/setting-mouse-cursors-in-flash-player-10/

自从我'我暂时坚持使用 Flex 3,我该如何做类似的事情?

update2:另外,这个问题有点类似于这个问题: 避免在 Flash CS3 中的动态文本字段上更改光标

不过,我使用的是标准 Flex Builder,而不是 Flash CS3。

In Flex, by default, when you mouse over a Text Input the mouse cursor is changed to the standard I cross bar. How can I change this cursor so the regular mouse pointer cursor is shown rather than the I cross bar?

update: Well, it seems this process is dirt simple in Flex 4 according to this blog post: http://blog.flexexamples.com/2008/11/03/setting-mouse-cursors-in-flash-player-10/

Since I'm stuck with Flex 3 for the time being, how can I do something similar?

update2: Also, this question is somewhat similar to this question:
Avoiding cursor change over dynamic text fields in Flash CS3

Though, I am using the standard Flex Builder, not Flash CS3.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

素年丶 2024-07-24 02:49:22

必须修改三个属性
使用手形光标 = true
按钮模式 = true
mouseChildren = false

Leete 本文的更多信息 http://www.anujgakhar.com/2008/03/27/flex-how-to-display-hand-cursor-on-components/

There are three properties that must be modified
useHandCursor = true
buttonMode = true
mouseChildren = false

Leete more information this article http://www.anujgakhar.com/2008/03/27/flex-how-to-display-hand-cursor-on-components/

兔姬 2024-07-24 02:49:22

您必须使用 CursorManager:

import mx.managers.CursorManager;

protected function textMouseOverHandler(event:Event):void
{
    CursorManager.setCursor(yourCursor, yourPriority, xOffset, yOffset);
    // Rest of your handler
}

protected function textMouseOutHandler(event:Event):void
{
    // be sure to set the cursor back here
}

You have to use the CursorManager:

import mx.managers.CursorManager;

protected function textMouseOverHandler(event:Event):void
{
    CursorManager.setCursor(yourCursor, yourPriority, xOffset, yOffset);
    // Rest of your handler
}

protected function textMouseOutHandler(event:Event):void
{
    // be sure to set the cursor back here
}
死开点丶别碍眼 2024-07-24 02:49:22

您可以使用带有标签的 HBOX,而不是 TextInput。 当鼠标悬停在标签上时,系统不会改变光标。 如果您希望用户可以编辑文本,您将需要做更多的工作。

public class MyTextInput extends HBox
{
public function  MyTextInput()
{
   super();
   var label:Label = new Label();
   label.text="some text";
   addChild(label);
   addEventListener(MouseEvent.CLICK, editProperties, true);
}
private function editProperties(event:MouseEvent)
{
  //do something to allow the user to edit the text e.g. PopupManager.createPopup
}
}

You could use a HBOX with a Label instead of a TextInput. The system will not change the cursor when the mouse is over the Label. If you want the text to be editable by the user you will need to do some more work.

public class MyTextInput extends HBox
{
public function  MyTextInput()
{
   super();
   var label:Label = new Label();
   label.text="some text";
   addChild(label);
   addEventListener(MouseEvent.CLICK, editProperties, true);
}
private function editProperties(event:MouseEvent)
{
  //do something to allow the user to edit the text e.g. PopupManager.createPopup
}
}
无尽的现实 2024-07-24 02:49:22

还有另一种方法,可以将您想要的任何组件的 buttonMode 属性设置为 true。 这将带来鼠标光标而不是文本光标。

there is also another way by setting buttonMode property to true for any component you wish. this brings the mouse cursor instead of text cursor.

久夏青 2024-07-24 02:49:21

只是为了澄清 - MouseCursorMouse 类也存在于Flash 10 上的 Flex 3。
因此,您可以挂钩 MOUSE_OVER 和 MOUSE_OUT 事件:

elem.addEventListener(MouseEvent.MOUSE_OVER, function(event:Event):void {
    Mouse.cursor = MouseCursor.BUTTON;
});

elem.addEventListener(MouseEvent.MOUSE_OUT, function(event:Event):void {
    Mouse.cursor = MouseCursor.ARROW;
});

Just to clarify - the MouseCursor and Mouse classes exist also in Flex 3 on flash 10.
So you can hook to the MOUSE_OVER and MOUSE_OUT events:

elem.addEventListener(MouseEvent.MOUSE_OVER, function(event:Event):void {
    Mouse.cursor = MouseCursor.BUTTON;
});

elem.addEventListener(MouseEvent.MOUSE_OUT, function(event:Event):void {
    Mouse.cursor = MouseCursor.ARROW;
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文