Flash 2. The GET and POST options are available only in Flash Player 4 and later versions.
getURL(url:String[,window:String[,"variables":String]]): Void
url The URL from which to obtain the document.
window An optional parameter specifying the window or HTML frame into which the document should load. You can enter the name of a specific window or select from the following reserved target names:
_self specifies the current frame in the current window.
_blank specifies a new window.
_parent specifies the parent of the current frame.
_top specifies the top-level frame in the current window.
variables 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.
Nothing.
Function; loads a document from a specific URL into a window or passes variables to another application at a defined URL. To test this function, make sure the file to be loaded is at the specified location. To use an absolute URL (for example, http://www.myserver.com), you need a network connection.
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.macromedia.com/images/shared/product_boxes/159x120/159x120_box_flashpro.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: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");
loadVariables(), XML.send(), XML.sendAndLoad(), XMLSocket.send()
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001360.html
Comments
recoveredfromflashMX2004 said on Aug 4, 2004 at 3:03 PM : recoveredfromflashMX2004 said on Aug 4, 2004 at 3:04 PM : larkydoo said on Aug 9, 2004 at 3:32 PM : Flash Tools said on Aug 20, 2004 at 2:14 AM : areohbee said on Oct 28, 2004 at 3:07 AM : McUsher said on Oct 29, 2004 at 5:21 AM : nShar said on Dec 22, 2004 at 5:06 AM : IFDNRG.com said on Jan 19, 2005 at 7:05 AM :