1 Reply Latest reply on Mar 28, 2007 2:15 PM by lli123

    How to avoid show original mouse image?

    lli123
      My problem is, athought the new mouse image for Cursor is show up, but the original mouse Cursor image still show up. So there are two images are displayed the same time. Here is the code from the Flex document:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application
      xmlns:mx=" http://www.adobe.com/2006/mxml"

      viewSourceURL="src/CursorCustom/index.html"
      width="400" height="160"
      >
      <mx:Script>
      <![CDATA[

      import mx.controls.Button;
      import mx.managers.CursorManager;
      import flash.events.*;

      // Embed the SWF that will be used as
      // the custom cursor.
      [Embed(source="images/hand.gif")]

      public var HourGlassAnimation:Class;

      private const ON_MESSAGE:String = "Custom Cursor ON";
      private const OFF_MESSAGE:String = "Custom Cursor OFF";

      private function busyCursorButtonHandler(event:MouseEvent):void
      {

      var toggleButton:Button = event.target as Button;
      if (toggleButton.selected)
      {

      // The setCursor() method returns a numeric ID for
      // the cursor being set. You can store and use this
      // ID later in a removeCursor() call, or, you can
      // use the static currentCursorID property of the
      // CursorManager class to achieve the same result.

      CursorManager.setCursor(HourGlassAnimation);
      toggleButton.label = ON_MESSAGE;
      }

      else
      {
      CursorManager.removeCursor(CursorManager.currentCursorID);
      toggleButton.label = OFF_MESSAGE;
      }

      }
      ]]>
      </mx:Script>

      <mx:Panel
      paddingBottom="10" paddingTop="10" paddingLeft="10" paddingRight="10"
      horizontalAlign="center" verticalAlign="middle"

      title="Custom cursor"
      >

      <!-- Toggle button turns the custom cursor on and off. -->
      <mx:Button
      label="{OFF_MESSAGE}" toggle="true"
      click="busyCursorButtonHandler(event);"

      />

      <mx:Text text="Click the button to display or hide the custom cursor."/>
      </mx:Panel>
      </mx:Application>


      Anybody has a idea how to control only show one mouse image for the mouse cursor at the time?

      Thanks,
      lucy