3 Replies Latest reply on Jun 28, 2010 3:06 AM by SeaBream

    Can't hide cursor in AIR?

    DMcQ Level 1
      Boy this should be really easy but I'm stumped.

      I can hide the cursor just fine using Mouse.hide() in a Flex app, but if I use the same code in an AIR app, the cursor doesn't hide. I'm using Flex Builder 3.

      So, I tried using a transparent png and assigning it to the cursor with CursorManager. Once again, works fine when the application is a Flex app, but doesn't work when I create an AIR app.

      Here's the code I'm using for the second technique. Again, this works as a Flex app but not AIR. Any thoughts?



      <?xml version="1.0" encoding="utf-8"?>
      <mx:WindowedApplication xmlns:mx=" http://www.adobe.com/2006/mxml"
      creationComplete="onCreationComplete()"
      layout="absolute">

      <mx:Script>
      <![CDATA[

      import mx.managers.CursorManager;

      [Embed('invisible_cursor.png')]
      [Bindable]
      public var InvisibleCursor:Class

      public function onCreationComplete()
      {
      CursorManager.setCursor(InvisibleCursor);
      }

      ]]>

      </mx:Script>
      </mx:WindowedApplication>



      Thanks,
      Daniel
        • 1. Re: Can't hide cursor in AIR?
          dvalenci
          hi Daniel,

          I tested out your code (added .hide() statements) and found also that this doesn't work; I've logged a bug in our system, thanks for the catch. If you create for example a button that you press to execute the same code, it does work, so it appears to only fail when it is an application component creation event.

          Hope this helps.

          Thanks,
          Daniel
          • 2. Re: Can't hide cursor in AIR?
            SeaBream Level 1

            I'm having a similar problem. I'm using Flash CS4 to create an AIR 2.02 project.

            Mouse.hide() doesn't work on the Macintosh.

            I did find a work around here. (http://blog.formatlos.de/2008/11/16/air-hiding-the-mouse/) which seems to work if you start the AIR file by double clicking it.

             

            However, if you set the AIR file to automatically start as a login item then the mouse cursor doesn't hide.

             

            I've tried this on OS 10.4 and OS 10.6 and its the same. It all works fine on Windows.

             

            This is a critical bit of functionality for all kiosk applications so if anyone has any other suggestions or work arounds I'd be keen to hear them.

            • 3. Re: Can't hide cursor in AIR?
              SeaBream Level 1

              Ok, here's an update on this. The problem seems to happen because the mouse cursor is in the top left corner of the screen on startup.

              If the cursor is here AIR can't hide it. If I manually move the cursor somewhere else on the screen the fix given seems to work.