03
Nov
08

Setting mouse cursors in Flash Player 10

The following example shows how you can set mouse cursors in Flash Player 10 by setting the Mouse object’s cursor property to one of the static constants in the MouseCursor class.

Full code after the jump.

To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see “Using the beta Gumbo SDK in Flex Builder 3″.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/11/03/setting-mouse-cursors-in-flash-player-10/ -->
<FxApplication name="Mouse_cursor_test"
        xmlns="http://ns.adobe.com/mxml/2009">
    <layout>
        <BasicLayout />
    </layout>

    <HGroup horizontalCenter="0" top="10">
        <FxButton label="{MouseCursor.ARROW}"
                click="Mouse.cursor = MouseCursor.ARROW;" />
        <FxButton label="{MouseCursor.AUTO}"
                click="Mouse.cursor = MouseCursor.AUTO;" />
        <FxButton label="{MouseCursor.BUTTON}"
                click="Mouse.cursor = MouseCursor.BUTTON;" />
        <FxButton label="{MouseCursor.HAND}"
                click="Mouse.cursor = MouseCursor.HAND;" />
        <FxButton label="{MouseCursor.IBEAM}"
                click="Mouse.cursor = MouseCursor.IBEAM;" />
    </HGroup>

    <VGroup horizontalCenter="0" verticalCenter="0">
        <TextInput text="mx:TextInput" />
        <Button label="mx:Button" buttonMode="true" />
    </VGroup>

</FxApplication>

View source is enabled in the following example.

This entry is based on a beta version of the Flex Gumbo SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex Gumbo SDK.


4 Responses to “Setting mouse cursors in Flash Player 10”


  1. 1 matthew Nov 4th, 2008 at 7:00 am

    thank u r information

    it very useful

    u r blog Is very nice

  2. 2 jidolstar Nov 4th, 2008 at 9:22 am

    thank!

  3. 3 Dale Fraser Nov 4th, 2008 at 9:44 am

    Missing the demo again :(

  4. 4 Lekkie Nov 4th, 2008 at 12:19 pm

    Call a java class from Flex (d class is residing on the local machine not remotely)

Leave a Reply

This blog is terrible at eating HTML tags. If you plan on posting code/XML, please escape your "<" characters as "&lt;" and your ">" characters as "&gt;".




Badge Farm

  • Powered by Redoable 1.2
  • Cornify
  • Feeds burnt by Feedburner
  • Feed