Flex 3: How can I change the mouse cursor while working on text input?

In Flex, by default, when you hover over text input, the mouse cursor changes to standard panel I. How can I change this cursor to display a normal mouse cursor, rather than a cross line I?

update: Well, this process seems to be 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 at the moment, how can I do something like this?

update2: Also, this question is somewhat similar to this question: Preventing cursor changes in dynamic text fields in Flash CS3

Although, I use the standard Flex Builder, not Flash CS3.

+6
flex cursors
source share
5 answers

Just to clarify - MouseCursor and Mouse also exist in Flex 3 on flash 10. Thus, you can connect 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; }); 
+7
source share

There are three properties that need to be changed. UseHandCursor = true buttonMode = true mouseChildren = false

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

+4
source share

You should use 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 } 
+2
source share

You can use HBOX with label instead of TextInput. The system will not change the cursor if the mouse is above the mark. 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 eg PopupManager.createPopup } } 
0
source share

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

-one
source share

All Articles