Native Mouse Cursor

09:52 AS3 FLA 10

Act now while we have available seating

Our on line school is private, affordable and interactive with trainer support.
Act now save your seat before someone else takes yours.
Act now

Why change mouse cursor behaviors

Historically when you wanted to hide mouse cursor you had to hide your mouse and start dragging your visuals in the location where the mouse used to be using the Mouse.hide() and startDrag/stopDrag. Only issue was that your mouse visibility was dependent on your flash player performance and frame-rate. The people of Adobe again came to the rescue with the next wave of features introduced to Flash Player 10.2. Now you have a way to send directly native cursor messages to your OS. You can now control when and how your native mouse cursor will work. Well only rule is the users mouse must be in the active area of your flash player 10.2 and the limitation of the OS. Now even if your flash will get stuck driving up a hill your mouse will still be around happy and unhurt.

Come on, its time to take control over the old ugly cursor and get creative.

What's in 'native mouse cursors new to flash player 10.2' Video

In this video we explore the basics of getting your flash to give away control over the mouse cursor and enable you to start talking with the OS directly switching. We do that by creating a vector that contains BitmapData(or datas) with an icon that is no bigger then 32 pixels by 32 pixels. After we got the right asset all that is left is for us to wrap it into a MousecursorData object that contains 3 properties:
  1. - Sets or gets the mouse icon BitMapData.
  2. MousecursorData.frameRate - Sets or gets the mouse frame rate.
  3. MouseCursorData.hotspot - Sets or gets the registration point of the mouse cursor icon.

After creating our mouse cursor data all that is left is to register it into the static class Mouse (using the function Mouse.registerCursor). We explore in the video all the steps explain them, breath and get you this concept all wrapped and ready. and if your thinking you will need for flash player 10.2 to be more wide spread, think again, as we explore this issue and talk about how you can avoid run time errors by exposing this feature only if your users are ready for it.

What's not this video regarding Mouse Cursor Icons:

how to get your Flash Builder/Flex to be ready for flash player 10.2 new classes

  1. Downlaod the latest flash builder (currently flash CS5 does not support flash player 10.2)
  2. Download the latest stable SDK(last tested to work without issues was
  3. unzip folder into your application folder under: /flash builde/sdks/
  4. Create a new project and set its SDK to be this SDK
  5. Watch the video

How to undo in run time your control over the users Mouse Cursor

Although we talk about creating custom mouse cursors. You can set the Mouse.cursor to give flash the 'management' responsibilities back at any time by sending to it the property "MouseCursor.AUTO" - Used to specify that the cursor should be selected automatically based on the object under the mouse.

Flash Mouse Cursor is cool but else can i do with it?

At this point you know everything you would ever need to know about your MouseCursorData but you are more then recommended to get to know a few more properties. The first is there is an array of cursors you can take advantage of besides MouseCursor.AUTO to learn more about them check class MouseCursor that contains static constants you can use(MouseCursor.ARROW,MouseCursor.AUTO,MouseCursor.BUTTON,MouseCursor.HAND,MouseCursorIBEAM).

I don't know why you would want to unregister a mouse cursor but in case you do you can always do that working directly with the Mouse class calling the Mouse.registerCursor counterpart Mouse.unregisterCursor

Useful links:


Our free content is sponsored by these ads become a prime member and get rid of them.

Act now while we have available seating

Our on line school is private, affordable and interactive with trainer support.
Act now save your seat before someone else takes yours.
Act now