I am having a windowed application as my base application. To avoid the tab bar icon for the app in the task bar , I close the native window and open up the contents from another window. Here I will be calling the http service method.But nothing happens,and no error is shown in compile and run time. All the other actions are working fine. why am I not able to call http service within window in adobe air
code in main app to open new window:
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);
}
code for window:
<?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>
Try to set your main window visibility to false instead of closing it. I guess it can think that you want to terminate your application (and all child windows of main window are also closed).