3 Replies Latest reply on Dec 30, 2010 7:56 AM by lakshdn

    Show Custom Busy Cursor on RemoteObject calls

    lakshdn

      Hi,

       

      I am trying to display a custom image as busy cursor while making remote object calls in flex 4 with cairngorm.

       

      i tried in two different ways and neither worked -

       

      First approach - declaring style for CursorManager in css style sheet:-

       

      CursorManager {

      busy-cursor: Embed(source="/com/officemax/amps/assets/images/ball-3.jpg");

      }

      This did not work as it could not resolve a namespace and i could not find CursorManager either with mx or s namespace.

       

      Second approach - set cursormanager style on initiliaze of application file:-

       

      [Embed(source="/com/officemax/amps/assets/images/ball-3.jpg")]

      public var busyImg:Class;


      and on init method-


      styleManager.getStyleDeclaration("mx.managers.CursorManager").setStyle("busy-cursor", busyImg);

       

      This did not work either. this returned CSSDeclaration class for the CursorManager but I could not see the cursor reflect.

       

      I do not want to set and remove cursor upon each call, i want to apply it globally.

      Any ideas are greatly appreciated.

       

      Thank You.

        • 1. Re: Show Custom Busy Cursor on RemoteObject calls
          saisri2k2 Level 4

          StyleManager.getStyleDeclaration("mx.managers.CursorManager").setStyle("busyCursor", busyImg);

           

          this worked for me

           

          try it on a small new project and see, if it works, move it to the actual project. If it works in the small project and does not work in the actual, then there is another process which is reverting the cursor. In order to know put a break point in the adobes 'CursorManagerImpl' class at the removeAllCursors() and other remove methods to see.

           

          Message was edited by: saisri2k2

          • 2. Re: Show Custom Busy Cursor on RemoteObject calls
            BhaskerChari Level 4

            @lakshdn,

             

            The two approached you used should work. I suspect surely you made mistakes..Well let me explain..

             

            In the CSS style declaration below make sure you have assigned the correct relative. If you are getting any error saying that it could not resolve the path or namespace then it means that you have not assigned the image path correctly. Make sure it is given correctly.

             

            CursorManager {

            busy-cursor: Embed(source="/com/officemax/amps/assets/images/ball-3.jpg");

            }

             

             

            Well coming to AS style of setting cursor manager . You have used systemManager with lower case for s and in the setStyle method you need to use the busyCursor instead of busy-cursor(similar to css).

             

            styleManager.getStyleDeclaration("mx.managers.CursorManager").setStyle ("busy-cursor", busyImg); - wrong way of assigning.

             

            StyleManager.getStyleDeclaration("mx.managers.CursorManager").setStyle ("busyCursor", busyImg); - correct way of assigning.

             

            Observe the changes I made in bold letters.

             


            Always remember when you are setting styles in AS using setStyle method you need to give the properties in the lower camel case but not as you give in the css. In css we can use any king of style (either word seperated by hyphen or lower camel case syntax)

             

            Hope this is clear ..make these changes and check..

             

            Thanks,

            Bhasker

            1 person found this helpful
            • 3. Re: Show Custom Busy Cursor on RemoteObject calls
              lakshdn Level 1

              Hi,

               

              Thank you guys, so it was the setStyle argument - busyCursor which worked and not "busy-cursor" css style.

               

              But "S"tyleManager is deprecated from later versions of Flex SDK, the new usage is "s"tyleManager, an implicit object that flex creates and makes it available during run-time.