Flex/Flash: Don't show 'bar' cursor when dragging over a TextField/TextArea?

Posted by David Wolever on Stack Overflow See other posts from Stack Overflow or by David Wolever
Published on 2010-06-01T15:51:11Z Indexed on 2010/06/01 15:53 UTC
Read the original article Hit count: 166

Filed under:
|
|

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

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).

© Stack Overflow or respective owner

Related posts about flex

Related posts about flash