Kirupa 'launch centered window' script fails in firefox

Hello,

I found a great tutorial on launching a centered pop up window that kirupa posted and firefox won’t execute it correctly or at all. I’m extremely frustrated because I need pop ups for my site to work and now it only functions in internet explorer or safari (mac). The url for the tutorial is http://www.flashkit.com/tutorials/Actionscripting/Launch-vazbo-1027/index.php

The way it works is that you have a frame action with the following function:

_global.openWinCentre = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) { getURL(“javascript:window.open(’”+url+"’,’"+winName+"’,’"+“width=”+w+", height="+h+",toolbar="+toolbar+",location="+location+",directories="+directories+", status="+status+",menubar="+menubar+",scrollbars="+scrollbars+",resizable="+resizable+", top=’+((screen.height/2)-("+h/2+"))+’,left=’+((screen.width/2)-("+w/2+"))+’"+"’); void(0);"); };

and then on the button that calls the pop up you add this:

on (release) {
//customize the window that gets opened
// 0 equals NO.
// 1 equals YES.
address = “http://www.unseenproductions.net/velvet.html”;
target_winName = “Velvet”;
width = 300;
height = 300;
toolbar = 0;
location = 0;
directories = 0;
status = 0;
menubar = 0;
scrollbars = 1;
resizable = 0;
//sends data back to the function
openWinCentre(address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);
}

This works great so why not with Firefox. Please help…!

-Llyfre

Here’s what I found --In Flash 8 the code, which worked for Flash 6, does not work any more. Flash has introduced a new class, the ExternalInterface class. This class has several methods, one of which is call. Write this actionScript in the fla as a frame action over a button:

“newWindow” is the argument holding your html file, which you want to open. You can define of course any height and width or position as you like.

import flash.external.*;
var newWindow:String;
myBut.onPress = function () {
newWindow = String (ExternalInterface.call (“openWindow”, “javascript.html”));
};

Write this script in the header of your HTML page which encodes your swf:

<SCRIPT language=“javascript”>
<!–
function openWindow(newWindow){
window.open(newWindow, “myFile”, “height=300, width=500, scrollbars=no, top=0”);
}
–>
</SCRIPT>

This works great for firefox and safari, but not ie.5.2 for mac, don’t know how well it works with the newer internet explorer for PC, my guess is just fine. Anyway, I was directed to this which exists at flashscript.biz.

-Llyfre