4 Replies Latest reply on May 9, 2011 10:38 AM by Drew747

    How would I get visible busy cursor while calling ImageSnapshot.captureImage?

    andrejusc Level 1

      Hi,

      I'm not sure if I understand correctly, but below is my very simple MXML file, where I try to show busy cursor before calling ImageSnapshot.captureImage. But instead my cursor dissapears atl all and then reappears after call is complete. Is it known functionality or should I use some callLater() call? Any help would be appreciated.

       

      My code:

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
      <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
      </fx:Declarations>
      <fx:Script>
        <![CDATA[
         import mx.graphics.ImageSnapshot;
         import mx.graphics.codec.JPEGEncoder;
         import mx.managers.CursorManager;
         private function clickHandler() : void {
          CursorManager.setBusyCursor();
          const encoder:JPEGEncoder = new JPEGEncoder();
          var imageSnapshot:ImageSnapshot = ImageSnapshot.captureImage(mainContainer, 96, encoder, true);
          CursorManager.removeAllCursors();
         }

        ]]>
      </fx:Script>
      <s:BorderContainer id="mainContainer" width="50%" height="50%">
        <s:Label x="40" y="44" text="My label" width="60" height="31"/>
        <s:Button x="30" y="79" label="Button" click="clickHandler()"/>
      </s:BorderContainer>
      </s:Application>