| window.runtime property | window.runtime.flash.net.URLRequestMethod |
| Inheritance | URLRequestMethod Object |
| Runtime Versions: | AIR 1.0, Flash Player 9 |
POST method or the GET method when sending data to a server.
See also
| Constant | Defined By | ||
|---|---|---|---|
| DELETE : String = "DELETE" [static]
Specifies that the URLRequest object is a DELETE. | URLRequestMethod | ||
| GET : String = "GET" [static]
Specifies that the URLRequest object is a GET. | URLRequestMethod | ||
| HEAD : String = "HEAD" [static]
Specifies that the URLRequest object is a HEAD. | URLRequestMethod | ||
| OPTIONS : String = "OPTIONS" [static]
Specifies that the URLRequest object is a OPTIONS. | URLRequestMethod | ||
| POST : String = "POST" [static]
Specifies that the URLRequest object is a POST. | URLRequestMethod | ||
| PUT : String = "PUT" [static]
Specifies that the URLRequest object is a PUT. | URLRequestMethod | ||
| DELETE | Constant |
static const DELETE:String = "DELETE"| Runtime Versions: | AIR 1.0 |
Specifies that the URLRequest object is a DELETE.
| GET | Constant |
static const GET:String = "GET"| Runtime Versions: | AIR 1.0, Flash Player 9 |
Specifies that the URLRequest object is a GET.
| HEAD | Constant |
static const HEAD:String = "HEAD"| Runtime Versions: | AIR 1.0 |
Specifies that the URLRequest object is a HEAD.
| OPTIONS | Constant |
static const OPTIONS:String = "OPTIONS"| Runtime Versions: | AIR 1.0 |
Specifies that the URLRequest object is a OPTIONS.
| POST | Constant |
static const POST:String = "POST"| Runtime Versions: | AIR 1.0, Flash Player 9 |
Specifies that the URLRequest object is a POST.
| PUT | Constant |
static const PUT:String = "PUT"| Runtime Versions: | AIR 1.0 |
Specifies that the URLRequest object is a PUT.
Note:To run this example, put a file named example.txt in the same directory as the HTML file. That file should be a simple text file containing a few words or lines of text. Also, add the AIRAliases.js file to that directory.
The example code does the following:
init() function creates a URLLoader instance named loader.loader object is passed to the configureListeners() method,
which adds listeners for each of the supported URLLoader events.request is created, which specifies name of the file to be loaded.method property of the request is set to URLRequestMethod.POST.request object is then passed to loader.load(), which loads the text file.complete event fires,
triggering the completeHandler() method. The completeHandler() method simply traces
the data property, the contents of the text file.Note: To test this example, do the following:
URLRequest() constructor points to a valid URL and port .
<html>
<head>
<script src="AIRAliases.js" />
<script>
function init() {
var loader = new air.URLLoader();
configureListeners(loader);
var request = new air.URLRequest("http://www.example.com/");
request.method = air.URLRequestMethod.POST;
loader.load(request);
}
function configureListeners(dispatcher) {
dispatcher.addEventListener(air.Event.COMPLETE, completeHandler);
dispatcher.addEventListener(air.Event.OPEN, openHandler);
dispatcher.addEventListener(air.ProgressEvent.PROGRESS, progressHandler);
dispatcher.addEventListener(air.SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
dispatcher.addEventListener(air.HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
dispatcher.addEventListener(air.IOErrorEvent.IO_ERROR, ioErrorHandler);
}
function completeHandler(event) {
var loader = air.URLLoader(event.target);
air.trace("completeHandler: " + loader.data);
}
function openHandler(event) {
air.trace("openHandler: " + event);
}
function progressHandler(event) {
air.trace("progressHandler loaded:" + event.bytesLoaded + " total: " + event.bytesTotal);
}
function securityErrorHandler(event) {
air.trace("securityErrorHandler: " + event);
}
function httpStatusHandler(event) {
air.trace("httpStatusHandler: " + event);
}
function ioErrorHandler(event) {
air.trace("ioErrorHandler: " + event);
}
</script>
</head>
<body onload='init()'>
</body>
</html>