window.runtime propertywindow.runtime.flash.net.URLRequestMethod
InheritanceURLRequestMethod Inheritance Object
Runtime Versions: AIR 1.0, Flash Player 9

The URLRequestMethod class provides values that specify whether the URLRequest object should use the POST method or the GET method when sending data to a server.

View the examples

See also

URLRequest
URLVariables


Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Public Methods
 MethodDefined By
 Inherited
hasOwnProperty(name:String):Boolean
Indicates whether an object has a specified property defined.
Object
 Inherited
isPrototypeOf(theClass:Object):Boolean
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
propertyIsEnumerable(name:String):Boolean
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
toString():String
Returns the string representation of the specified object.
Object
 Inherited
valueOf():Object
Returns the primitive value of the specified object.
Object
Constants
 ConstantDefined 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
Constant Detail
DELETEConstant
static const DELETE:String = "DELETE"
Runtime Versions: AIR 1.0

Specifies that the URLRequest object is a DELETE.

GETConstant 
static const GET:String = "GET"
Runtime Versions: AIR 1.0, Flash Player 9

Specifies that the URLRequest object is a GET.

HEADConstant 
static const HEAD:String = "HEAD"
Runtime Versions: AIR 1.0

Specifies that the URLRequest object is a HEAD.

OPTIONSConstant 
static const OPTIONS:String = "OPTIONS"
Runtime Versions: AIR 1.0

Specifies that the URLRequest object is a OPTIONS.

POSTConstant 
static const POST:String = "POST"
Runtime Versions: AIR 1.0, Flash Player 9

Specifies that the URLRequest object is a POST.

PUTConstant 
static const PUT:String = "PUT"
Runtime Versions: AIR 1.0

Specifies that the URLRequest object is a PUT.

Examples
URLRequestMethodExample.as

The following example loads and displays the data found in a local text file. It also traces event handling information.

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:

  1. The init() function creates a URLLoader instance named loader.
  2. The loader object is passed to the configureListeners() method, which adds listeners for each of the supported URLLoader events.
  3. A URLRequest instance named request is created, which specifies name of the file to be loaded.
  4. The method property of the request is set to URLRequestMethod.POST.
  5. The request object is then passed to loader.load(), which loads the text file.
  6. When the URLLoader has finished loading the text file the 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:

  1. Add the AIRAliases.js file to the project directory.
  2. Change the code so that the URLRequest() constructor points to a valid URL and port .
  3. 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>