macromedia help home
Bookmark this page using your favorite bookmark manager

Creating pop-up browser windows in flash

Sample

This is a sample flash button that triggers a html browser window when it is clicked. Click the button to open a pop-up window.

Flash can trigger a browser pop-up in many ways, this sample explains how to do this by JavaScript.

Code to write in the flash file

Create a new flash file, create a simple button in it, click the button and type this code on the flash button:

  1. on (release) {
  2. getURL("javascript:openNewWindow('http://www.macromedia.com','thewin',
  3. 'height=400,width=400,toolbar=no,scrollbars=yes')");
  4. }

Code to write in the html page

Now open the html page that contains the swf button and place this code between <head>...</head> area of the html code:

  1. <script language="JavaScript">
  2. function openNewWindow(URLtoOpen, windowName, windowFeatures) {
  3. newWindow=window.open(URLtoOpen, windowName, windowFeatures); }
  4. </script>

Now you are done. When the flash button is clicked then the flash button will trigger the JavaScript from the html page.

Options

You can adjust the first code (the on on the flash button) in order to adjust pop-up window options as follows: url to open, window name, height, width, toolbars (yes/no) and scroll bars (yes/no).

Download samples

Download the sample files
Rate this content; the results will appear next to article links in site:
You need flash player