Re: [Flashcoders] Asynchronous ExternalInterface Calls From Javascript, possible?
You could make use of ExternalInterface.addCallback. Therefore the JS function you call with ExternalInterface.call starts some process off then returns straight away. When your process is done it calls your registered flash callback. Therefore you end up with asynchronous. All said and done, why not call the webservice straight from flash? On 6/19/07, Seth Green [EMAIL PROTECTED] wrote: I have a web app that uses a flash movie as a proxy to a web service. Therefore, I have javascript calling flash methods that in turn make requests to a web service and then route the response back to javascript. I don't need my javascript functions to wait on this calls, but ExternalInterface is inherently synchronous. And to my surprise I have found that a flash method which does nothing but make a web service request can take 100ms or more. This is unacceptably slow, but especially so since my javascript code has to hang while the flash method does its business. Does anyone have any experience with this issue, or can provide a workaround or hint as to how I might make these calls asynchronous? thanks in advance. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Asynchronous ExternalInterface Calls From Javascript, possible?
I'm not calling a JS function from flash until the end of this process. It is the beginning of this process that I want to be made asynchronous. In the beginning I am calling a flash function from JS. That is the piece I am trying to get to be asynchronous. jtgxbass wrote: You could make use of ExternalInterface.addCallback. Therefore the JS function you call with ExternalInterface.call starts some process off then returns straight away. When your process is done it calls your registered flash callback. Therefore you end up with asynchronous. All said and done, why not call the webservice straight from flash? On 6/19/07, Seth Green [EMAIL PROTECTED] wrote: I have a web app that uses a flash movie as a proxy to a web service. Therefore, I have javascript calling flash methods that in turn make requests to a web service and then route the response back to javascript. I don't need my javascript functions to wait on this calls, but ExternalInterface is inherently synchronous. And to my surprise I have found that a flash method which does nothing but make a web service request can take 100ms or more. This is unacceptably slow, but especially so since my javascript code has to hang while the flash method does its business. Does anyone have any experience with this issue, or can provide a workaround or hint as to how I might make these calls asynchronous? thanks in advance. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Asynchronous ExternalInterface Calls From Javascript, possible?
setInterval is a handy way to break scope. Have the AS method called by JS set an interval for let's say 10ms, and then have the method assigned to the interval take care of business. Javascript will be free and Flash will keep on going. -Steven Seth Green wrote: I'm not calling a JS function from flash until the end of this process. It is the beginning of this process that I want to be made asynchronous. In the beginning I am calling a flash function from JS. That is the piece I am trying to get to be asynchronous. jtgxbass wrote: You could make use of ExternalInterface.addCallback. Therefore the JS function you call with ExternalInterface.call starts some process off then returns straight away. When your process is done it calls your registered flash callback. Therefore you end up with asynchronous. All said and done, why not call the webservice straight from flash? On 6/19/07, Seth Green [EMAIL PROTECTED] wrote: I have a web app that uses a flash movie as a proxy to a web service. Therefore, I have javascript calling flash methods that in turn make requests to a web service and then route the response back to javascript. I don't need my javascript functions to wait on this calls, but ExternalInterface is inherently synchronous. And to my surprise I have found that a flash method which does nothing but make a web service request can take 100ms or more. This is unacceptably slow, but especially so since my javascript code has to hang while the flash method does its business. Does anyone have any experience with this issue, or can provide a workaround or hint as to how I might make these calls asynchronous? thanks in advance. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Asynchronous ExternalInterface Calls From Javascript, possible?
Aren't web service calls asynchronous, or am I missing something? I mean, you typically have to set up a result function to handle the web service response. Calling the service should not hold the function. In any case, I'd expect you'd have to handle this like follows: //javascript function call(){ swfObject.call(); } //flash function call(){ } function callBack(){ getURL(javascript:callBack();) } //javascript function callBack(){ //this would be called when the service response is recieved. } On 6/20/07, Steven Sacks [EMAIL PROTECTED] wrote: setInterval is a handy way to break scope. Have the AS method called by JS set an interval for let's say 10ms, and then have the method assigned to the interval take care of business. Javascript will be free and Flash will keep on going. -Steven Seth Green wrote: I'm not calling a JS function from flash until the end of this process. It is the beginning of this process that I want to be made asynchronous. In the beginning I am calling a flash function from JS. That is the piece I am trying to get to be asynchronous. jtgxbass wrote: You could make use of ExternalInterface.addCallback. Therefore the JS function you call with ExternalInterface.call starts some process off then returns straight away. When your process is done it calls your registered flash callback. Therefore you end up with asynchronous. All said and done, why not call the webservice straight from flash? On 6/19/07, Seth Green [EMAIL PROTECTED] wrote: I have a web app that uses a flash movie as a proxy to a web service. Therefore, I have javascript calling flash methods that in turn make requests to a web service and then route the response back to javascript. I don't need my javascript functions to wait on this calls, but ExternalInterface is inherently synchronous. And to my surprise I have found that a flash method which does nothing but make a web service request can take 100ms or more. This is unacceptably slow, but especially so since my javascript code has to hang while the flash method does its business. Does anyone have any experience with this issue, or can provide a workaround or hint as to how I might make these calls asynchronous? thanks in advance. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Asynchronous ExternalInterface Calls From Javascript, possible?
It turns out that the asynchronous web service call actually takes some extra time (like 100ms) the FIRST time you use that web service method. Subsequent calls to that method only take 1ms. So, this first time you call this function from JS, JS is blocked for about 100ms //flash ExternalInterface.addCallback(service_GetEmails, this, getEmails); function getEmails():Void { _pendingCall = service.getEmails(emailIds); _pendingCall.onFault = function(fault){service_onFault(fault);} _pendingCall.onResult = function(result){toJS(result);} } //JS myMovie.service_GetEmails(); Subsequent calls are super fast. Not sure why this is. Must have something to do with some overhead incurred during the first call. I'd be interested to know the answer. I didn't realize it was only on the first call that so much time was taken. I can actually live with that. Otheriwse, the setInterval and/or setTimeout suggestion would have done the trick. Thanks elibol wrote: Aren't web service calls asynchronous, or am I missing something? I mean, you typically have to set up a result function to handle the web service response. Calling the service should not hold the function. In any case, I'd expect you'd have to handle this like follows: //javascript function call(){ swfObject.call(); } //flash function call(){ } function callBack(){ getURL(javascript:callBack();) } //javascript function callBack(){ //this would be called when the service response is recieved. } On 6/20/07, Steven Sacks [EMAIL PROTECTED] wrote: setInterval is a handy way to break scope. Have the AS method called by JS set an interval for let's say 10ms, and then have the method assigned to the interval take care of business. Javascript will be free and Flash will keep on going. -Steven Seth Green wrote: I'm not calling a JS function from flash until the end of this process. It is the beginning of this process that I want to be made asynchronous. In the beginning I am calling a flash function from JS. That is the piece I am trying to get to be asynchronous. jtgxbass wrote: You could make use of ExternalInterface.addCallback. Therefore the JS function you call with ExternalInterface.call starts some process off then returns straight away. When your process is done it calls your registered flash callback. Therefore you end up with asynchronous. All said and done, why not call the webservice straight from flash? On 6/19/07, Seth Green [EMAIL PROTECTED] wrote: I have a web app that uses a flash movie as a proxy to a web service. Therefore, I have javascript calling flash methods that in turn make requests to a web service and then route the response back to javascript. I don't need my javascript functions to wait on this calls, but ExternalInterface is inherently synchronous. And to my surprise I have found that a flash method which does nothing but make a web service request can take 100ms or more. This is unacceptably slow, but especially so since my javascript code has to hang while the flash method does its business. Does anyone have any experience with this issue, or can provide a workaround or hint as to how I might make these calls asynchronous? thanks in advance. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com