【问题标题】:Flex Client application - HTTPRequest fail in the initialize functionFlex 客户端应用程序 - HTTPRequest 在初始化函数中失败
【发布时间】:2011-02-17 17:52:35
【问题描述】:

我的 flex 客户端应用程序存在严重问题。 我有一个带有 php web 服务的 apache 服务器。 flex 客户端发出一个 httpservice 请求。 我注意到从应用程序的 creationComplete 事件运行的 httpservice 请求并不总是从服务器获取数据。 但从用户操作调用的 HTTP 服务请求始终有效。

我还注意到,当我直接从 Flex Builder 3 运行 flex 客户端应用程序而不将其上传到服务器时,问题发生的频率较低。

在应用程序中:

mx:Application creationComplete="Init()" verticalScrollPolicy="off" horizontalScrollPolicy="off" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#5d8eb1"

private function Init():void
{
   var http_request:HTTPService = new HTTPService();
   http_request.url = "http://"+this.server_name+":"+this.server_port+"/services/client/client_result.php";

http_request.resultFormat = "e4x";
   http_request.addEventListener("result",resultFunc);

   http_request.send();
   http_request.disconnect();
}

【问题讨论】:

  • 格式化您的代码以提高可读性。我们在这里为您提供帮助,但我们很难阅读它。

标签: php apache-flex flash apache httpservice


【解决方案1】:

我有一个带有 php web 服务的 apache 服务器。 flex 客户端发出 httpservice 请求。

  1. 你为什么在这里提到 WebServices。我没有解释你的第一句话。

  2. 当您没有得到任何东西时,您的 faultEvent 中会发生什么?

我注意到从应用程序的 creationComplete 事件运行的 httpservice 请求并不总是从服务器获取数据。但从用户操作调用的 HTTP 服务请求始终有效。

你能展示你的creationComplete的代码吗? 您的函数是否在创建完成后被调用 你跟踪你的函数是否被调用?

【讨论】:

  • 嗨,我添加了 Application mxml 标记,其 creationComplete = "Init()"; HTTPRequests 有时有效,有时无效,所以我很确定 Init 函数称为 HTTPService。我没有任何故障事件,只有空结果事件。但是,当我从用户操作中调用 httpservice 时,例如单击按钮或其他东西,结果总是会出现。
猜你喜欢
  • 2019-05-05
  • 2018-07-16
  • 2012-09-10
  • 2020-10-04
  • 1970-01-01
  • 2013-07-02
  • 2011-10-15
  • 1970-01-01
  • 2016-04-08
相关资源
最近更新 更多