Skip to main content
Participant
April 8, 2010
Answered

Popup HTML Window

  • April 8, 2010
  • 4 replies
  • 1031 views

Im struggling with the javascript to open a popup from flash.

I have a swf (swf1) with a container that loads in an external .swf (swf2) file.

swf2 has a button that i would like to open a popup window. I have put the following javascript code in the actionscript for the button

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

I have put the following code in the html file that loads the swf file....

<SCRIPT LANGUAGE=JavaScript>
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
  newWindow=window.open(URLtoOpen, windowName, windowFeatures);
}
</SCRIPT>

Here is the code that embeds the swf1 (with the container) on the html page....

<A HREF=javascript:openNewWindow('http://www.google.com','thewin','height=400,width=400,toolbar=no,scrollbars=yes') ></A> <!-- text used in the movie-->
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="890" height="360">
      <param name="movie" value="homepageFlash.swf" />
      <param name="quality" value="high" />
      <param name="wmode" value="transparent" />
      <embed src="homepageFlash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="890" height="360"></embed>
    </object>

Am i missing something. I have read numerous tutorials and did them step for step and cant get them to work on my project....

Thank you in advance for any replys and help on this matter!!!!  

This topic has been closed for replies.
Correct answer Serendipitous_Odyssey16E5

HI,

I used your same code and it is working. What problem you are facing?

Did you hosted the application, and running a hosted version. This working on hosted version.

Regards

Ritesh Newal

4 replies

athomas32Author
Participant
April 16, 2010

So i have gotten my popup to work, but when opening it in Firefox it is really small and will not enlarge. What is the trick to get it to display in Firefox and display?

Participating Frequently
April 20, 2010

HI,

You can mad resizable window by sending resizable=yes from flash and pass it to javascript.

Regards

athomas32Author
Participant
April 9, 2010

Thank you guys... I got it to work. I was just running it on my local machine and it wasnt working, but once I published it to my website. it works fine..

kglad
Community Expert
Community Expert
April 9, 2010

you should check that against different browsers.  using getURL() to call a javascript function is unreliable.

Participating Frequently
April 9, 2010

HI,

I used your same code and it is working. What problem you are facing?

Did you hosted the application, and running a hosted version. This working on hosted version.

Regards

Ritesh Newal

kglad
Community Expert
Community Expert
April 9, 2010

you can use externalinterface to call a javascript function in your html from flash.  and you can use getURL to call a javascript function that you define within flash.  but, doing a combination of those two like you're doing, isn't going to work.