Flex 3: How can I change the Mouse Cursor when mousing over a Text Input?

DyreSchlock picture DyreSchlock · Apr 22, 2009 · Viewed 24.6k times · Source

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.

Answer

tm_lv picture tm_lv · Oct 1, 2010

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;
});