Problem with URLRequest on Android/iOS
Hello guys,
I am using URLRequest in my AIR for Android and iOS application. I have a microcontroller that has a server. I use a router that generates a fixed address for my card. So in my application, I send the command to the server microcontroller that filters the command performs the action and returns the state of the board. In the simulator, I send the command and caught the return normally. On Android or iOS, I send the command, it performs the action, but the return comes as undefined. I do not know what else to do. Below is my code:
this.urlRequest = new URLRequest(Endereco.placaIP + comando);
this.urlLoader = new URLLoaderMais();
this.urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
this.urlLoader.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, responseListener);
this.urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, responseListener);
this.urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, responseListener);
this.urlLoader.addEventListener(flash.events.Event.COMPLETE, completeHandler, false, 0, true);
this.urlLoader.load(this.urlRequest);
My return:
var index:int = event.target.index;
var resposta:Object = event.target.data;
if(resposta != null)
{
label.text = resposta.toString() + " " + event.target.bytesLoaded;
this.total++;
this.ltMenu.dataProvider.getItemAt(index).operacao = false;
resposta == "LIGADA" ? this.ltMenu.dataProvider.getItemAt(index).acessorio.isSelected = true : this.ltMenu.dataProvider.getItemAt(index).acessorio.isSelected = false;
this.ltMenu.dataProvider.updateItemAt(index);
this.ltMenu.removeEventListener(starling.events.Event.CHANGE, ltMenuSelected);
this.ltMenu.selectedIndex = -1;
this.ltMenu.addEventListener(starling.events.Event.CHANGE, ltMenuSelected);
}
if(total == 7)
{
this.ltMenu.touchable = true;
}
Any help would be welcome, this is a job for course completion. Thank you.
