The URLRequest class captures all of the information in a single HTTP
request. URLRequest objects are passed to the
of the Loader, URLStream, and URLLoader classes, and to other loading
operations, to initiate URL downloads. They are also passed to the
download() methods of the
A SWF file in the local-with-filesystem sandbox may not load data from, or provide data to, a resource that is in the network sandbox.
By default, the calling SWF file and the URL you load must be in the same domain. For example, a SWF file at www.adobe.com can load data only from sources that are also at www.adobe.com. To load data from a different domain, place a URL policy file on the server hosting the data.
However, in Adobe AIR, content in the application security sandbox (content installed with the AIR application) is not restricted by these security limitations. For content running in Adobe AIR, files in the application security sandbox can access URLs using any of the following URL schemes:
Content running in Adobe AIR that is not in the application security sandbox observes the same restrictions as content running in the browser (in Flash Player), and loading is governed by the content's domain and any permissions granted in URL policy files.
For more information related to security, see the Flash Player Developer Center Topic: Security.
Creates a URLRequest object. If
true, the request is encoded using the system code page,
rather than Unicode. If
false, the request is encoded using Unicode, rather than the
system code page.
The URL to be requested. You can set the URL later by using the
The MIME content type of the content in the the
The default value is
methods do not support the
When sending a POST request, the values of the
data properties must correspond properly. The value of
contentType property instructs servers on how to
interpret the value of the
dataproperty is a URLVariables object, the value of
dataproperty is any other type, the value of
contentTypeshould indicate the type of the POST data that will be sent(which is the binary or string data contained in the value of the
FileReference.upload(), the Content-Type of the request is set automatically to
multipart/form-data, and the value of the
contentTypeproperty is ignored.
In Flash Player 10 and later, if you use a multipart Content-Type(for example "multipart/form-data") that contains an upload(indicated by a "filename" parameter in a "content-disposition" header within the POST body), the POST operation is subject to the security rules applied to uploads:
Also, for any multipart Content-Type, the syntax must be valid (according to the RFC2046 standards). If the syntax appears to be invalid, the POST operation is subject to the security rules applied to uploads.
An object containing data to be transmitted with the URL request.
This property is used in conjunction with the
property. When the value of
data is appended to the value of
URLRequest.url, using HTTP query-string syntax. When the
method value is
POST(or any value other than
GET), the value of
data is transmitted in the
body of the HTTP request.
The URLRequest API offers binary
POST support and support
for URL-encoded variables, as well as support for strings. The data object
can be a ByteArray, URLVariables, or String object.
The way in which the data is used depends on the type of object used:
GET, data of ByteArray type is not supported. Also, data of ByteArray type is not supported for
POST, the variables are encoded using x-www-form-urlencoded format and the resulting string is used as
POSTdata. An exception is a call to
FileReference.upload(), in which the variables are sent as separate fields in a
GET, the URLVariables object defines variables to be sent with the URLRequest object.
This data is not sent until a method, such as
the URLRequest object.
Note: The value of
contentType must correspond to
the type of data in the
data property. See the note in the
description of the
Controls the HTTP form submission method.
For SWF content running in Flash Player(in the browser), this property
is limited to GET or POST operations, and valid values are
For content running in Adobe AIR, you can use any string value if the content is in the application security sandbox. Otherwise, as with content running in Flash Player, you are restricted to using GET or POST operations.
For content running in Adobe AIR, when using the
navigateToURL() function, the runtime treats a URLRequest
that uses the POST method(one that has its
URLRequestMethod.POST) as using the GET method.
Note: If running in Flash Player and the referenced form has no
body, Flash Player automatically uses a GET operation, even if the method
is set to
URLRequestMethod.POST. For this reason, it is
recommended to always include a "dummy" body to ensure that the correct
method is used.
The array of HTTP request headers to be appended to the HTTP request. The array is composed of URLRequestHeader objects. Each object in the array must be a URLRequestHeader object that contains a name string and a value string, as follows:
Flash Player and the AIR runtime impose certain restrictions on request headers; for more information, see the URLRequestHeader class description.
Not all methods that accept URLRequest parameters support the
requestHeaders property, consult the documentation for the
method you are calling. For example, the
FileReference.download() methods do not support the
Due to browser limitations, custom HTTP request headers are only
POST requests, not for
The URL to be requested.
Be sure to encode any characters that are either described as unsafe in
the Uniform Resource Locator specification(see
http://www.faqs.org/rfcs/rfc1738.html) or that are reserved in the URL
scheme of the URLRequest object(when not used for their reserved
purpose). For example, use
"%25" for the percent(%) symbol
"%23" for the number sign(#), as in
By default, the URL must be in the same domain as the calling file, unless the content is running in the Adobe AIR application security sandbox. If you need to load data from a different domain, put a URL policy file on the server that is hosting the data. For more information, see the description of the URLRequest class.
For content running in Adobe AIR, files in the application security sandobx - files installed with the AIR application - can access URLs using any of the following URL schemes:
Note: IPv6(Internet Protocol version 6) is supported in AIR and
in Flash Player 18.104.22.168 and later. IPv6 is a version of Internet
Protocol that supports 128-bit addresses(an improvement on the earlier
IPv4 protocol that supports 32-bit addresses). You might need to activate
IPv6 on your networking interfaces. For more information, see the Help for
the operating system hosting the data. If IPv6 is supported on the hosting
system, you can specify numeric IPv6 literal addresses in URLs enclosed in
brackets(), as in the following.
Generated using TypeDoc