apache-flex - 中止 RemoteObject 调用

标签 apache-flex actionscript-3 httprequest remoteobject

是否可以中止 Flex RemoteObject 调用?我尝试了以下方法,但 http 请求仍在后台加载:

var r:RemoteObject = new RemoteObject('<myDestination>');
r.source('myClass');
r.myMethod.addEventListener(ResultEvent.RESULT, myResponse);

r.myMethod(); // lets say this method takes 5 second to call

r.channelSet.disconnectAll(); // I thought this would abort the actual HTTP request but its still running

编辑

我感兴趣的是释放浏览器的 HTTP 管道,就像在 javascript 中一样,您可以在 XHR 上使用 abort。

最佳答案

您可以尝试AbstractOperationcancel()方法.

r.getOperation("OperationName").cancel();

更新:

This is the problem, I invoke a large call then the user leaves the view so I don't need to wait for the response anymore. Right now the http request is blocking any further requests. Got any solution for this?

您应该在服务器端服务中进行另一个操作来停止当前服务。然后,当您需要中止当前正在运行的服务时,取消该操作(在flex上),然后通过从flex端调用stop服务来调用停止服务。

停止服务器端当前正在运行的线程,取决于您使用的服务器端。

关于apache-flex - 中止 RemoteObject 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5578406/

相关文章:

actionscript-3 - ActionScript 3 FFMPEG 丢失视频元数据

java - 如何在struts2 Action 方法中获取客户端IP地址?

java - Grails 从请求中提取正文数据

apache-flex - Flex 4 中的 parentApplication 和 FlexGlobals.topLevelApplication

java - Flash 客户端通过全双工连接(聊天或游戏)与 Java 服务器对话的最佳方式

actionscript-3 - Starling - 将 SWF 图像(矢量)加载到图像中

node.js - 如何在 Node/Express 客户端中正确呈现服务器端错误?

ios - 使用 Flex Mobile 4.6 在 iOS 上上传图库或捕获的图像

android - 无法在 iOS 上与 Bing Map 交互; Android 不显示折线(Flex 移动应用程序,通过 StageWebView 使用 Javascript API)

actionscript-3 - MovieClip 调整大小,但其子项的高度和宽度没有改变?