Reputation: 2805
I'm a newbie in adobe flash development.
I have form login, and I want to login with my api, which like this: /api/login and with user & pass.
And I don't know how to.
Which I have?
What I need?
Thanks so much!
Upvotes: 2
Views: 403
Reputation: 3151
You can send GET/POST request with the URLLoader
class:
import flash.net.URLLoader;
import flash.events.Event;
import flash.net.URLRequest;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequestMethod;
var urlRequest:URLRequest = new URLRequest("LINK_HERE");
urlRequest.method = URLRequestMethod.POST;
urlRequest.data = your_json_object;
var urlLoader:URLLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, onComplete);
urlLoader.load(urlRequest);
function onComplete(e:Event):void
{
trace(e.currentTarget.data); // the response from the server
}
Upvotes: 1