Flash implementation jump to external different URL code

Source: Internet
Author: User
Tags html form

To open a Web page in a browser window, or to pass data to another application at the defined URL, you can use either the GetURL () global function or the Movieclip.geturl () method. For example, you can have a button linked to a new Web site, or you can send a timeline variable to a CGI script to work with the data just as you would an HTML form. You can also specify a target window, just as you would use an HTML anchor tag (<a></a>) to determine the target window.

For example, the following code opens the Adobe.com home page in an empty browser window when the user clicks the button instance named Homepage_btn:

The code is as follows Copy Code

Attaching to Frames
Homepage_btn.onrelease = function () {
GetURL ("http://www.53dream.com", "_blank");
};


You can also use a GET or POST method to send a variable along with the URL. This functionality can be used if a page that is being loaded from an application server, such as a ColdFusion server (CFM) page, is expected to receive form variables. For example, suppose you want to load a CFM page named adduser.cfm with two form variables that are expected to receive name first and then age. To do this, you can create a movie clip named VARIABLES_MC that defines the two variables shown below:

The code is as follows Copy Code

Variables_mc.firstname = "Francois";
Variables_mc.age = 32;


The following code then loads adduser.cfm into the empty browser window and passes the Variables_mc.name and variables_mc.age in the POST header to the CFM page:

The code is as follows Copy Code

Variables_mc.geturl ("adduser.cfm", "_blank", "POST");


The functionality of the GetURL () depends on the browser you are using. The surest way to make all browsers have the same functionality is to call JavaScript functions in HTML code and use the JavaScript window.open () method to open the window. Add the following HTML and JavaScript to your HTML template:

The code is as follows Copy Code

<script language= "JavaScript" >
<--
function Opennewwindow (myurl) {
window.open (Myurl, "Targetwindow");
}
-->
</script>


You can invoke Opennewwindow from the SWF file using the following ActionScript:

  code is as follows copy code

var Myurl: String = http://www.111cn.net;
GetURL (' Javascript:opennewwindow (' + String (myurl) + ');

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.