7 Replies Latest reply on Jun 19, 2007 10:44 AM by EliteScientist

    RemoteObject show Busy Cursor ?

    jlm23 Level 1
      Has anyone figured out how to activate the show busy cursor for a remote object constructed and sent from AS?
        • 1. Re: RemoteObject show Busy Cursor ?
          jpwrunyan Level 1
          There are two classes.
          One is mx.rpc.remoting.RemoteObject
          the other is mx.rpc.remoting.mxml.RemoteObject

          Depending upon the one you use, the behavior will be different.
          • 2. Re: RemoteObject show Busy Cursor ?
            jlm23 Level 1
            Thanks for answering. Wow does this look complication to use. The documentation also says for Flex Data Service only. I am only using Flash remoting. There aren't any examples of using this. I think I will roll my on status indicators.

            Thanks again.
            • 3. Re: RemoteObject show Busy Cursor ?
              EliteScientist
              as I was looking through Adobe's Source I found that when Adobe Registers an Object to set a Busy Cursor, it listens on the a few events, progress, ioerror, and complete....

              As the object dispatches a progress event, adobe resets the busy cursor. This is why when we do it once with cursor manager, it changes back when our mouse moves. Adobe continually set the busy cursor as the call progresses... This really sucks..

              Currently I'm trying to find out which object in the RPC package dispatches those events so I can register my remoteObjects to set the busy cursor.

              Since adobe did not include the source to their RPC package, this task is a little more difficult that usual. It may be easier to just set a timer or interval to keep setting it until' the procedure completes then remove it and kill the interval
              • 4. Re: RemoteObject show Busy Cursor ?
                doug777 Level 1
                I have no problems with this code:

                import mx.rpc.events.*;
                import mx.rpc.remoting.RemoteObject;
                import mx.managers.CursorManager;
                import mx.collections.ArrayCollection;
                import mx.utils.ObjectUtil;
                import mx.controls.Alert;

                public function callCF():void{
                var svc:RemoteObject = new RemoteObject();
                svc.destination = "ColdFusion";
                svc.source = "myCFC";
                svc.myMethod.addEventListener("result", resultHandler);
                svc.addEventListener("fault", faultHandler);
                mx.managers.CursorManager.setBusyCursor();
                svc.myMethod();
                }

                private function resultHandler(event:ResultEvent):void{
                var result:ArrayCollection = ArrayCollection(event.result);
                mx.managers.CursorManager.removeBusyCursor();
                myFunction(result);
                }

                private function faultHandler(event:FaultEvent):void{
                Alert.show( ObjectUtil.toString(event.fault) );
                mx.managers.CursorManager.removeBusyCursor();
                }

                Doug
                • 5. Re: RemoteObject show Busy Cursor ?
                  EliteScientist Level 1
                  My code is identical as for setting the busy curser when the operation is called and removing it when results or a fault is dispatched.

                  The issue is, since its all asynchronous other operation can happen simultaneously, such as redraws, etc...

                  I have a very complex interface and remote calls executing from user clicks, etc.....

                  The problem I'm having is when I set the busy cursor and then move the mouse, the busy cursors returns back to normal before removeBusyCursor is executed.

                  I noticed that adobe's function to register an object to set the busy cursor, constantly sets it on progress....

                  I need to figure out a way to do that with RemoteObject since there is no progress event.
                  • 6. Re: RemoteObject show Busy Cursor ?
                    doug777 Level 1
                    I don't have that problem. Indeed, if I remove the -removeBusyCursor- call, the cursor remains the busy cursor indefinitely, no matter I move the mouse, click or whatever.

                    This, I guess, is because I have daisy-chained my remote calls, so that if a sequence of remote calls is required before all the data is available for the user, the busy cursor is set at the beginning of the chain and removed at the end.

                    This is the only way I can find to prevent errors occurring through programmatic or users' requests for data before it is available.

                    However this leads to further problems and like you I am desperately searching for a solution. (See my thread - Daisy-chaining Remote Object Calls.)

                    Doug
                    • 7. Re: RemoteObject show Busy Cursor ?
                      EliteScientist Level 1
                      Ok I've actually found the issue with my application. I was using a Resize Class that removed the cursor on every mouse move. (Talk about poor Programming) I'll probably have to code my own Resize Class. I fixed their code and my busy cursor stays.

                      You can create your own cursor management class. and create a registerToUseBusyCursor and unRegisterToUseBusyCursor..... and add/remove listeners to listen for the invoke event and set the busy cursor, and listen for the result & fault event to remove the busy cursor...

                      Then you can extend the remoteObject class and register it to use the busy cursor.