views:

58

answers:

1

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

+1  A: 

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

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

Interesting!

Stray
Hadn't thought of that. It's not ideal (I've got a bunch of programatically generated TextFields), but it's better than nothing. Thanks.
David Wolever