User Guide
320 Chapter 2: ActionScript Language Reference
In the following example, getURL() is used to send an e-mail message:
myBtn_btn.onRelease = function(){
getURL("mailto:you@somedomain.com");
};
In the following ActionScript, JavaScript is used to open an alert window when the SWF file is
embedded in a browser window:
myBtn_btn.onRelease = function(){
getURL("javascript:alert('you clicked me')");
};
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(), XML.send(), XML.sendAndLoad(), XMLSocket.send()