3 Replies Latest reply on Dec 17, 2010 7:37 AM by The Flex Viking

    RemoteObject InvokeEvent how to preventDefault

    Angel Ivanov

      I am trying to register InvokeEvent listener on every RemoteObject and to stop remote call if some logic requires it. Is it possible? Until now I have not success! Thank you!

        • 1. Re: RemoteObject InvokeEvent how to preventDefault
          Angel Ivanov Level 1

          OK. I found that Operation class has method cancel(), but after invoke it the call still happen! Please help!

          • 2. Re: RemoteObject InvokeEvent how to preventDefault
            Xung

            Hi Angel Ivanov,

             

            Maybe you must create a customized class, such as

             

            public class InvokeEventCustom extends InvokeEvent{

                 public function InvokeEventCustom(type:String, cancelable:Boolean,...){

                      super(...);

                 }

            }

             

            And you must specify parameter: cancelable into true.

            And you create a customized class, such as

             

            public class RemoteObjectCustom extends RemoteObject{

                 //Codes

                 //Events (InvokeEventCustom)

            }

             

            And use the RemoteObjectCustom instead of RemoteObject

             

            Please try, I think it's OK. But I'm not use and test

             

            Andy

            • 3. Re: RemoteObject InvokeEvent how to preventDefault
              The Flex Viking Level 1

              A couple thoughts.

               

              I have a similar use case in which a user keys in search information.  If they stop keying in for 1 second, the system invokes a RemoteObject query operation on the backend.  If they key in more information before the results were returned, I want to cancel any pending operations and start a new one.  Otherwise, screwy things might happen with updating the UI with a result set that is really no longer valid.

               

              Now, this is only a query, so it's not updating the back-end.  So, I can do something like RemoteObject.operations["invoke"].cancel();

               

               

              If you were actually updating the backend and wanted to cancel.  Well, I don't think there is anyway to HALT an operation at the RemoteObject destination once it's been passed to it.  I think you would have to build that sort of functionality into your communication with your destination.