IMG: Zest spacer
Website header graphic Website header logo graphic Website header graphic
IMG: Website top left header graphic IMG: Website right header graphic
IMG: Website left upper header graphic
  Who we are - What we do - What we've done - Contact us
IMG: Website right mid header graphic
IMG: Website left header graphic Website header shadow graphic IMG: Website right bottom header graphic
Website header graphic
LINK: For more information on RSS news feeds News provided by
InternetWorld365
Website header graphic
Website header logo graphic Website header graphic
Free Multimedia Tips: How to Saturday 4 Feb 2012
<< Back - Find another Tip - Request a Tip
Date added Avg Rating Votes
February 7, 2005 4.3/5.0 10
 
TIP: Customised Javascript popup windows from within Flash...

If you want to be able to open customised pop up windows from within a flash (.swf) movie, using a few lines of simple Javascript. With this code you will be able to open new browser windows with specific attributes, with or without scroll bars, address bars, status bars, set widths and heights. This tip aims to show you how easy this is to achieve with a few simple lines of code. To achieve this you will only need to use the actionscript getURL command in your flash movie and you will need to embed a simple Javascript function within the <head> </head> of your web page.

Relevant reading: Resizing a browser window from flash & Open a window with specific attributes

This Flash Javascript tip assumes that you know how to make simple buttons in Flash and you know how to use the getURL actionscript command. If so, lets begin with making a simple button in a flash movie and adding the code below to your button. (copy and paste)

This actionscript code simply calls a Javascript function called OpenMyPopUp from within the html page that hosts the flash movie. Within this function we will define the new windows properties and attributes that will be activate when a user clicks the flash button.

The javascript function
This script simply calls the Javascript function OpenMyPopUp() which will be embedded in your html page that will open the new browser window. Now open your html web page that will host the flash movie and add the code below between the <head> </head> tags.

This simple function once called will open our new web browser window with these specific attributes and dimensions specified in the variable windowFeatures. You can easily change these values to suit your particular popup window needs. Below lists and briefly explains the attributes used in our script:

Attribute Brief Description
Width The new windows Width (numerical value in pixels)
Height The new windows Height (numerical value in pixels)
Toolbar Shows or hides the browser buttons (0=hide 1=show)
Location Shows or hides the URL address bar (0=hide 1=show)
Status Shows or hides the status bar at the bottom. (0=hide 1=show)
MenuBar Shows or hides the top menus i.e File, Edit, etc. (0=hide 1=show)
ScrollBars Shows or hides the scrollbars. (0=hide 1=show)
Resizable Allows or disallows the window to be resized. (0=disallow 1=allow)

As with most optional features you can use 0 or 1, yes or no as the defining values for off and on. The variable myWindowName defines the name of the window and the self explanatory variable whichPage is the page you wish to load up in your new window.

Once you have saved both your flash movie and your html page, give them a test run and you will find that you can now open new customised popup windows from within flash.

The benefit of this method
A great advantage of handling the window popup code outside of the flash movie, is that you can control everything outside the movie, which saves the time and trouble of editing and exporting your flash movie each time you want to make a simple change.

Live example
Below we have prepared the code for a simple page to demo the Javascript popup window feature, please copy and paste the code into a blank page and test it out on your computer.

There are plenty of variations of what can be achieved with these simple Javascript functions. We have included a very rough page of the above scripts output results.

Downloads: Download Tip files (.zip)

Relevant reading: Resizing a browser window from flash & Open a window with specific attributes

Have fun ;0)

Rate this resource: Customised Javascript popup windows from within Flash...
(Great)
<< Back - Find another Tip - Request a Tip
 

^ Advertisment ^
 
If you have any Requests or suggestions that you would like us to add

If you would like to see any particular/specific (free) tips or you have a few suggestions or comments, then we would love to hear from you.

Please drop us an email @: or fill in the form below.

Your name:
Email: (optional)

Suggestions:
Note: Your details will only be used to contact you directly to let you know on the status of your suggestion. We do not re-sell or re-distribute any contact information to any third party. We respect your privacy as we respect our own within the digital ether.
[top]
 
Website Nav
^ Advertisment ^
Our home - Our partners - Our links - Testimonials - Jargon Buster - Sitemap
© Copyright Digital-Zest.com. 2001-2005. ALL RIGHTS RESERVED T&C - Privacy