0
我想提出一个非常简单的HTTPService请求瓦特/ PHP文件,是我的远程服务器上不起作用:的HTTPService ......在localhost
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:halo="library://ns.adobe.com/flex/halo"
>
<fx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
private function check(evt:ResultEvent):void
{
if(service.lastResult.output == "yes")
{
test.text = "successful";
}
}
]]>
</fx:Script>
<fx:Declarations>
<mx:HTTPService id="service" result="check(event)" showBusyCursor="true" method="POST" url="http://www.example.com/php.php" useProxy="false">
</mx:HTTPService>
</fx:Declarations>
<mx:VBox width="100%" height="100%">
<mx:Button x="10" y="122" label="Submit" id="Submit" click="service.send();"/>
<mx:TextArea id="test" width="50%" height="50%" />
</mx:VBox>
</s:Application>
当我运行在我的远程生成的Flash文件服务器,它工作100%,test.text被填充到“成功”。
但是,当我在localhost上运行它时,test.text仍然是空白的。如果我在Flex中检查我的网络监视器,httpservice是成功的,所以crossdomain.xml似乎设置正确...我做错了什么?我一直在旋转我的轮子一段时间w /出一个线索。谢谢!
你调试它在本地主机上? HTTPService是否执行你的check()函数?否则,请尝试向您的HTTPService添加一个错误处理程序,以查看错误的原因。 – 2010-11-08 10:55:00