Flex/Flash:不显示“栏”拖动文本字段/文本区域时的光标?

发布于 2024-09-03 17:49:23 字数 1361 浏览 3 评论 0原文

正如标题所示,当我在 TextField 上单击并拖动时,如何防止出现“bar”光标?例如,考虑以下交互:

替代文本 http://img.skitch.com/20100601-dhsqsgfsjphfdf3eambshww72m .png

我想防止光标在步骤“2”中更改为“bar”。

我怎样才能做到这一点?

我尝试摆弄 selectable 标志:

protected static function fixMouseOverAfordance(field:TextField):void {
    var iOwnClick:Boolean = false;

    function handleMouseOver(event:MouseEvent):void {
        if (event.buttonDown) {
            field.selectable = iOwnClick;
        } else {
            field.selectable = true;
            iOwnClick = false;
        }
    }

    field.addEventListener(MouseEvent.MOUSE_OVER, handleMouseOver,
                              false, EventPriority.CURSOR_MANAGEMENT+1);
    field.addEventListener(MouseEvent.ROLL_OVER, handleMouseOver,
                              false, EventPriority.CURSOR_MANAGEMENT+1);
    field.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseOver,
                              false, EventPriority.CURSOR_MANAGEMENT+1);

    field.addEventListener(MouseEvent.MOUSE_DOWN,
        function(event:MouseEvent):void {
            iOwnClick = true;
            field.selectable = true;
    });
}

但是当鼠标第一次在文本字段上移动时,“bar”光标仍然出现(但是,在它被移出然后移回之后,它做了正确的事)。

As the title suggests, how can I prevent the "bar" cursor from appearing when I click-and-drag over a TextField? For example, consider this interaction:

alt text http://img.skitch.com/20100601-dhsqsgfsjphfdf3eambshww72m.png

I'd like to prevent the cursor changing to the "bar" in step "2".

How can I do that?

I've tried fiddling with the selectable flag:

protected static function fixMouseOverAfordance(field:TextField):void {
    var iOwnClick:Boolean = false;

    function handleMouseOver(event:MouseEvent):void {
        if (event.buttonDown) {
            field.selectable = iOwnClick;
        } else {
            field.selectable = true;
            iOwnClick = false;
        }
    }

    field.addEventListener(MouseEvent.MOUSE_OVER, handleMouseOver,
                              false, EventPriority.CURSOR_MANAGEMENT+1);
    field.addEventListener(MouseEvent.ROLL_OVER, handleMouseOver,
                              false, EventPriority.CURSOR_MANAGEMENT+1);
    field.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseOver,
                              false, EventPriority.CURSOR_MANAGEMENT+1);

    field.addEventListener(MouseEvent.MOUSE_DOWN,
        function(event:MouseEvent):void {
            iOwnClick = true;
            field.selectable = true;
    });
}

But the "bar" cursor still appears the first time the mouse is moved over the text field (however, after it has been moved out then moved back in, it does the right thing).

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

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

发布评论

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

评论(1

冷夜 2024-09-10 17:49:23

透明MC在上面,适合吗?在黑暗中拍摄...

另外,不确定 mouseEnabled / mouseChildren 在这里会产生什么影响。

有趣的!

Transparent MC over the top, to fit? Shot in the dark...

Also, not sure what impact mouseEnabled / mouseChildren would have here.

Interesting!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文