我有一个窗口应用程序作为我的基本应用程序。为了避免任务栏中应用程序的标签栏图标,我关闭了本机窗口并从另一个窗口打开内容。这里我将调用http服务方法。但是没有任何反应,编译和运行时也没有显示错误。所有其他操作都工作正常。为什么我无法在 adobe air 的窗口内调用 http 服务
主应用程序中的代码以打开新窗口:
public function init():void {
nativeWindow.close();
var newWindow:MyWin = new MyWin();
newWindow.systemChrome = NativeWindowSystemChrome.NONE;
newWindow.type = NativeWindowType.LIGHTWEIGHT;
newWindow.transparent = true;
newWindow.open(true);
}
窗口代码:
<?xml version="1.0" encoding="utf-8"?>
<mx:Window name="MyWin"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="httpService()" >
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;
public function httpService():void {
var httpSer : HTTPService = new HTTPService();
httpSer.url = "http://flexairapp...";
httpSer.method = "GET";
httpSer.addEventListener(ResultEvent.RESULT, httpResult);
httpSer.addEventListener(FaultEvent.FAULT, httpFault);
httpSer.resultFormat="text";
var parameters:Object = new Object();
httpSer.send();
}
public function httpResult(event:ResultEvent):void {
var dataResult:String = event.result.toString();
}
public function httpFault(event:FaultEvent):void {
var faultstring:String = event.fault.faultDetail;
}
]]>
</fx:Script>
</mx:Window>