MACROMEDIA FLASH |
LAUNCHING A NEW WINDOW: TECHNIQUE TWO |
Technique Two: Get URL JavaScript Call
Unsupported by: IE 3.0 (PC only), IE 2.0, IE 4.5 (Mac only)
Right-click (or CTRL-Click on Mac) and choose "Save Link As..." todescription:
In Technique two, we avoid FSCommand altogether--and hence the requirement for ActiveX or LiveConnect--by using a call to JavaScript in a getURL action on a frame or button. The JavaScript is simply a function that pops up a window. This technique is known as the "javascript:" protocol, and works exactly like normal calls to javascript in the HREF of an anchor tag (eg. <A HREF="javascript:myfunction()">).
how to:
javascript:launchwin('yourpage.html' , 'newwindow' , 'height=150,width=300')
For each window you want to pop up, just change the filename "yourpage.html" to match the name of the file you want to appear in the new window. You can also change the height and width, or add as many extra features as are supported by the window.open method. For a list of those features, and for more information on the javascript used in the window launcher, visit javascript utopia's article on the subject.
<HTML> <HEAD> <TITLE>Your Page Title Goes Here</TITLE> <!-- Popup Window Version 2.0 Last Updated: May 7, 1999 Code maintained at: http://www.moock.org/webdesign/javascript/ Copy permission granted for non-commercial uses. Written by Colin Moock.--> <SCRIPT LANGUAGE="JavaScript"> var javascript_version = 1.0;</SCRIPT> <SCRIPT LANGUAGE="JavaScript1.1"> javascript_version = 1.1;</SCRIPT> <SCRIPT LANGUAGE="JavaScript"> var newwin; function launchwin(winurl,winname,winfeatures) { //This launches a new window and then //focuses it if window.focus() is supported. newwin = window.open(winurl,winname,winfeatures); if(javascript_version > 1.0) { //delay a bit here because IE4 encounters errors //when trying to focus a recently opened window setTimeout('newwin.focus();',250); } } </SCRIPT> </HEAD> <BODY> Place your movie here. </BODY> </HTML>
issues to consider:
Technique Two is much more stable and supported than Technique One and does not require frames or back button workarounds like Technique Three. It is the cleanest approach, however, it excludes users of IE 2.0 and IE 3.0 on pc, and IE 4.5 on macs.
recommendation:
If you're not worried about preventing those IE viewers from seeing your content, Technique Two is the easiest and most reliable way to open a new browser window from Flash.