Error while switch state and call api

31 views
Skip to first unread message

ocean pear

unread,
Oct 6, 2015, 8:03:38 PM10/6/15
to HaxeFlixel
Hi everyone,

I'm in state A, I call API like this and switch to state B. API'result return --> error, app exit immediatly(test on mobile). Please help me how to run the app with out exit like that
Thank you very much!!!

var request:URLRequest = new URLRequest("https://onepay.com/api");
var loader:URLLoader=new URLLoader(request);
loader.addEventListener(Event.COMPLETE, function(ev:Event):Void {
    //TODO SOMETHING
}
FlxG.switchState(new B());

Andrei Regiani

unread,
Oct 7, 2015, 7:10:05 AM10/7/15
to HaxeFlixel
First of all, find out where exatly the crash occurs, if when you call that API or when changing the state, I think it has nothing to do with FlxG.switchState.
Test separated state B and A, then just try to use that URLLoader.

P.S. Certificate SSL error + NotFound for "https://onepay.com/api"

Trieu Tran Quoc

unread,
Oct 8, 2015, 11:22:56 AM10/8/15
to HaxeFlixel
@Andrei Regiani: example link is not important, just a example.
I think problem is api return the response when state A has just null (current state is B).
Please try to remove all listener of URLLoader before switching to new state.
I hope this help.
Reply all
Reply to author
Forward
0 new messages