Chapter 27 Example 9
♥0 |
Line 27 |
Modified 2010-02-03 06:15:29 |
MIT License
archived:2017-03-20 03:53:12
ActionScript3 source code
/**
* Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/wyXX
*/
package {
import com.actionscriptbible.Example;
import flash.events.*;
import flash.net.*;
public class ch27ex9 extends Example {
public function ch27ex9() {
var url:String = "http://actionscriptbible.com/files/login.php";
var request:URLRequest = new URLRequest(url);
request.method = URLRequestMethod.POST;
var vars:URLVariables = new URLVariables();
vars.login = true;
vars.user = "Roger";
request.data = vars;
var loader:URLLoader = new URLLoader(request);
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHttpStatus);
loader.addEventListener(Event.COMPLETE, onLoadComplete);
}
protected function onHttpStatus(event:HTTPStatusEvent):void {
trace("HTTP response code " + event.status);
}
protected function onLoadComplete(event:Event):void {
trace("Response follows >>>>>>");
var loader:URLLoader = URLLoader(event.target);
trace(loader.data);
}
}
}