Flash 8, Simple JavaScript POPUP Window from button

Posted on 2009-04-29
Last Modified: 2013-12-25
I am creating a Flash CD which will run from an autostart.  I am working in Flash 8.  At some point I will need to pass variables from an XML file that populate a scrolling MC.   These will be companies that are offering coupons.  Each company will have info about the company coming from the XML file.  There will be a Click to Print Coupon button next to each company.

For demonstration, I need to have the button open a pre-defined popup window which I will place the company info and a simple javascript print button.  Down the road I will need the popup to be populated by the variables in the MC.

Below is the action script code I have been monkeying with.  It doesn't open a popup it open a complete browser with no url (file name).

This popup function should have nothing to do with a browser.
on (release) {

getURL ("'popup.htm','ne wWin','width=400,height=300,left=0,top=0,toolbar=N o,location=No,scrollbars=No,status=No,resizable=No ,fullscreen=No'); NewWindow.focus(); void(0);");


Open in new window

Question by:TecTaoMC
    LVL 8

    Accepted Solution

    Unfortunately if you are running this as a projector then you won't have Javascript available to you so that will not function as expected. Javascript runs inside a browser only.

    If you are not worried about mac compatibility, your easiest way through is to use an HTA wrapper. This is effectively an HTML file which will run as an application - borderless, fullscreen, whatever. Because it's a browser you also get the benefit of being able to launch popups and utilise javascript.

    The basic setup involves creating your HTML, embedding the SWF as usual and then adding a HTA tag near the top inside the <head> tag. The file extension needs to be .hta

    Here's a primer from Microsoft:

    Alternately you may want to explore AIR for a bit of cross-platform compatibility action:

    The attached snippet is an HTA app stub - it's set to run fullscreen with no borders. Save the contents into a file called "test.hta" and you can double-click to run. Alter the code to embed your SWF inside the body and you're done.
    		<TITLE>My Monster Application</TITLE>
    		 <!-- style the window -->
    		embed your swf here

    Open in new window


    Author Comment

    Thanks for getting back to me on this ccarey.  I read up on this and tried the code.  Didn't seem to work work after switching and making IE my default browser.  But with the limitation of only Microsoft and not Mac I'm going to have to look for another solution.

    I believe it's not an HTML issue but a Flash Action Script issue that I need to explore.  The process for this CD is to allow a viewer to scroll particular businesses in a specific geo location.  The businesses for a particular category are loaded through an XML file containing the data.

    Through a scrolling component, the viewer can look at all businesses.  Each business will offer savings through a printable coupon.  Next to the business is a button to print the coupon.

    I've tried the popup which if I were doing this in PHP would be no problem.  I found and edited an action script that would load an external Movie Clip.

    Any thoughts would be appreciated.

    LVL 8

    Expert Comment

    The AIR solution will give you that cross-platform (mac/pc) functionality.

    Without using a browser-based solution the closest you will get is

    on (release) {
         getURL ('popup.htm','_blank');

    Customising the window size and so forth requires javascript, which isn't available from a vanilla Flash projector. Calling just the URL you are interested in will at least give you the content you desire in a browser window.

    Author Comment

    ccarey, thanks again for your inmput.  I went back an re-read you notes from the first post and found I didn't save the html file as a HTA, when once I did, it opened to a full screen taking over my monitor window.  Had to such down and reboot since I couldn't get it to close.

    I can see the following process.  There is an auto start on the CD that starts up a starter.exe file what auto starts and within a second opends the HTA html page with the flash swf files for the presentation.  Ihen useing javascript to open popups should work

    Thanks for the time the now I have something new to familiarize myself with.

    LVL 8

    Expert Comment

    alt+F4 to close it, or you can put a button in that executes a javascript:window.close()

    You can actually just use the HTA as the target for the autorun, without the need for another EXE

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: CSS Specialist

    We don’t have to sell you on the idea of becoming a developer. If you’re you here, you already know it’s one of the most lucrative (and fastest growing) career tracks out there. It’s CSS that allows you to set yourself apart from other web and mobile developers.

    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
    The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now