Hey Kirupa,
In the past we have gotten complaints (sorta) about how the centered pop up in flash tutorial doesn’t work correctly when opening multiple windows (using multiple buttons).
Well something came up that made me decide to take a crack at re-writing the code in the tutorial a bit so it will work better for multiple windows.
These are only a few slight modifications of the code, nothing real major, but it helps a lot. Would you mind updating that tutorial to accomodate the new code?
The tutorial:
http://www.kirupa.com/developer/mx/centered_popup.htm
The new code:
This is the new function for opening the centered window. I remove the variable myWin, and the if/else statement.
[AS]_global.openWinCentre = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {
getURL(“java**script: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);");
};[/AS]
The code for the button can stay the same, since the function is now _global you can just use openWinCentre to call it no matter where the button is located.
So what do you think? Worth it?