| window.runtime property | window.runtime.flash.net.URLRequestMethod |
| Inheritance | URLRequestMethod Object |
| Runtime Versions: | AIR 1.0, |
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 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 |
public static const DELETE:String = "DELETE"| Runtime Versions: | 1.0 |
Specifies that the URLRequest object is a DELETE.
GET | Constant |
public static const GET:String = "GET"| Runtime Versions: | AIR 1.0, |
Specifies that the URLRequest object is a GET.
HEAD | Constant |
public static const HEAD:String = "HEAD"| Runtime Versions: | 1.0 |
Specifies that the URLRequest object is a HEAD.
OPTIONS | Constant |
public static const OPTIONS:String = "OPTIONS"| Runtime Versions: | 1.0 |
Specifies that the URLRequest object is OPTIONS.
POST | Constant |
public static const POST:String = "POST"| Runtime Versions: | AIR 1.0, |
Specifies that the URLRequest object is a POST.
Note:
When using the navigateToURL() function, the runtime
treats a URLRequest that uses the POST method (one that has its method property set to
URLRequestMethod.POST) as using the GET method.
PUT | Constant |
public static const PUT:String = "PUT"| Runtime Versions: | 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:
- The
init()function creates a URLLoader instance namedloader. - The
loaderobject is passed to theconfigureListeners()method, which adds listeners for each of the supported URLLoader events. - A URLRequest instance named
requestis created, which specifies name of the file to be loaded. - The
methodproperty of the request is set toURLRequestMethod.POST. - The
requestobject is then passed toloader.load(), which loads the text file. - When the URLLoader has finished loading the text file the
completeevent fires, triggering thecompleteHandler()method. ThecompleteHandler()method simply traces thedataproperty, the contents of the text file.
Note: To test this example, do the following:
- Add the AIRAliases.js file to the project directory.
- Change the code so that the
URLRequest()constructor points to a valid URL and port . - Create an application descriptor file for the project, and test the project using ADL.
<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>
Thu Sep 29 2011, 02:34 AM -07:00

Object
Hide Inherited Public Properties
Show Inherited Properties