50
ActionScript language elements
method
:
String
[optional] - A
GET
or
POST
method for sending variables. If there are no
variables, omit this parameter. The
GET
method appends the variables to the end of the URL,
and is used for small numbers of variables. The
POST
method sends the variables in a separate
HTTP header and is used for sending long strings of variables.
Example
This example loads an image into a movie clip. When the image is clicked, a new URL is
loaded in a new browser window.
var listenerObject:Object = new Object();
listenerObject.onLoadInit = function(target_mc:MovieClip) {
target_mc.onRelease = function() {
getURL("http://www.macromedia.com/software/flash/flashpro/", "_blank");
};
};
var logo:MovieClipLoader = new MovieClipLoader();
logo.addListener(listenerObject);
logo.loadClip("http://www.helpexamples.com/flash/images/image1.jpg",
this.createEmptyMovieClip("macromedia_mc", this.getNextHighestDepth()));
In the following example,
getURL()
is used to send an e-mail message:
myBtn_btn.onRelease = function(){
getURL("mailto:[email protected]");
};
You can also use
GET
or
POST
for sending variables. The following example uses
GET
to append
variables to a URL:
var firstName:String = "Gus";
var lastName:String = "Richardson";
var age:Number = 92;
myBtn_btn.onRelease = function() {
getURL("http://www.macromedia.com", "_blank", "GET");
};
The following ActionScript uses
POST
to send variables in the HTTP header. Make sure you
test your documents in a browser window, because otherwise your variables are sent using
GET
:
var firstName:String = "Gus";
var lastName:String = "Richardson";
var age:Number = 92;
getURL("http://www.macromedia.com", "_blank", "POST");
See also
loadVariables function
,
send (XML.send method)
,
sendAndLoad (XML.sendAndLoad
method)
Summary of Contents for Flash Lite 2
Page 1: ...Flash Lite 2 x ActionScript Language Reference...
Page 22: ...22 Contents...
Page 244: ...244 ActionScript language elements...
Page 760: ...760 ActionScript classes...