Flash Script – Popup Windows in Flash

Share this article

This tutorial will show you how to create a cool pop up windows with no toolbars.

1. Create a button in your Flash file.

2. Right click the button and go to actions give actions:

     getURL ("JavaScript:openWin('test.html', '250', '250')");

3. Publish your movie, selecting the HTML and Flash options you prefer.

4. Open the html page in notepad, and insert the following code in between the <head> and </head> tags.

 <script language="JavaScript"> 
function openWin(url, w, h)
{
var winprop = "width=" + w + ",height=" + h;
openwin = window.open(url,'',winprop);
}
</script>


That's it! Preview your page in a browser.

Frequently Asked Questions about Script Popup Windows in Flash

How can I create a popup window in Flash?

Creating a popup window in Flash involves a few steps. First, you need to create a new Flash document and draw a button on the stage. Then, you need to assign an instance name to the button in the properties panel. After that, you need to add an event listener to the button that will trigger a function when the button is clicked. This function will use the navigateToURL method to open a new browser window. You can specify the URL and window target as parameters in this method.

Can I control the size and position of the popup window?

Yes, you can control the size and position of the popup window by using JavaScript in the HTML page that contains the Flash movie. You can use the window.open method in JavaScript to open a new window and specify its size and position. However, this method requires that the user’s browser settings allow popup windows.

How can I add content to the popup window?

You can add content to the popup window by creating an HTML page with the content you want to display. Then, you can specify the URL of this page in the navigateToURL method in your Flash document. When the popup window opens, it will display the content of this HTML page.

Can I use ActionScript 3 to create a popup window?

Yes, you can use ActionScript 3 to create a popup window in Flash. The process is similar to using ActionScript 2, but there are some differences in the syntax and methods used. For example, you can use the URLRequest class and the navigateToURL function in ActionScript 3 to open a new browser window.

Why is my popup window not appearing?

If your popup window is not appearing, it could be due to several reasons. One common reason is that the user’s browser settings are blocking popup windows. Another reason could be that there is an error in your code. Make sure that you have correctly specified the URL and window target in the navigateToURL method.

Can I create a popup window that displays a Flash movie?

Yes, you can create a popup window that displays a Flash movie. You can do this by creating an HTML page that embeds the Flash movie using the object or embed tag. Then, you can specify the URL of this page in the navigateToURL method in your Flash document.

How can I customize the appearance of the popup window?

The appearance of the popup window is determined by the HTML page that it displays. You can customize the appearance of this page using CSS. For example, you can change the background color, font size, and layout of the page.

Can I create a popup window that closes automatically?

Yes, you can create a popup window that closes automatically after a certain period of time. You can do this by using JavaScript in the HTML page that the popup window displays. You can use the setTimeout method in JavaScript to close the window after a specified number of milliseconds.

Can I create a popup window that opens when the Flash movie loads?

Yes, you can create a popup window that opens when the Flash movie loads. You can do this by adding an event listener to the stage that triggers a function when the movie loads. This function can use the navigateToURL method to open the popup window.

Can I create multiple popup windows from a single Flash movie?

Yes, you can create multiple popup windows from a single Flash movie. You can do this by creating multiple buttons in the movie, each with its own event listener and function. Each function can open a different popup window.

Georgina LaidlawGeorgina Laidlaw
View Author

Georgina has more than fifteen years' experience writing and editing for web, print and voice. With a background in marketing and a passion for words, the time Georgina spent with companies like Sausage Software and sitepoint.com cemented her lasting interest in the media, persuasion, and communications culture.

Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form