Package | flash.net |
Class | public dynamic class URLVariables |
Inheritance | URLVariables Object |
Language version: | ActionScript 3.0 |
Runtime version: |
data
property
of the URLRequest class, and with flash.net package
functions.
See also
Method | Defined by | ||
---|---|---|---|
URLVariables(source:String = null)
Creates a new URLVariables object.
| URLVariables | ||
Converts the variable string to properties of the specified URLVariables object.
| URLVariables | ||
Indicates whether an object has a specified property defined.
| Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter.
| Object | ||
Indicates whether the specified property exists and is enumerable.
| Object | ||
Sets the availability of a dynamic property for loop operations.
| Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions.
| Object | ||
Returns a string containing all enumerable variables,
in the MIME content encoding application/x-www-form-urlencoded.
| URLVariables | ||
Returns the primitive value of the specified object.
| Object |
URLVariables | () | constructor |
public function URLVariables(source:String = null)
Language version: | ActionScript 3.0 |
Runtime version: |
Creates a new URLVariables object. You pass URLVariables
objects to the data
property of URLRequest objects.
If you call the URLVariables constructor with a string,
the decode()
method is automatically called
to convert the string to properties of the URLVariables object.
source:String (default = null ) — A URL-encoded string containing name/value pairs.
|
decode | () | method |
public function decode(source:String):void
Language version: | ActionScript 3.0 |
Runtime version: |
Converts the variable string to properties of the specified URLVariables object.
This method is used internally by the URLVariables events. Most users do not need to call this method directly.
Parameterssource:String — A URL-encoded query string containing name/value pairs.
|
Error — The source parameter must be a URL-encoded query
string containing name/value pairs.
|
// The first method passes the string to be decoded to the URLVariables class constructor: var urlVariables:URLVariables = new URLVariables("firstName=Tom&lastName=Jones"); lbl.text = urlVariables.lastName + "," + urlVariables.firstName; // The second method uses the decode() method to parse the URL encoded string: var urlVariables:URLVariables = new URLVariables(); urlVariables.decode("firstName=Tom&lastName=Jones"); lbl.text = urlVariables.lastName + "," + urlVariables.firstName;
toString | () | method |
public function toString():String
Language version: | ActionScript 3.0 |
Runtime version: |
Returns a string containing all enumerable variables, in the MIME content encoding application/x-www-form-urlencoded.
ReturnsString —
A URL-encoded string containing name/value pairs.
|
Highlights of the example follow:
request
, taking the URL of the remote application as a parameter.data
property of the URLRequest object.navigateToURL
, which opens a new browser window
to the remote application's URL.Note: To run the example, the remote application URL in the example must be replaced with a working URL. Additionally, you would need server code to process the information captured by Flash Player in the URLVariables object.
package { import flash.display.Sprite; import flash.net.navigateToURL; import flash.net.URLRequest; import flash.net.URLVariables; public class URLVariablesExample extends Sprite { public function URLVariablesExample() { var url:String = "http://www.[yourDomain].com/application.jsp"; var request:URLRequest = new URLRequest(url); var variables:URLVariables = new URLVariables(); variables.exampleSessionId = new Date().getTime(); variables.exampleUserLabel = "guest"; request.data = variables; navigateToURL(request); } } }