Open multiple popup windows at once?

Hi, I’d really appreciate some help with a small problem I’m having with the centred popup tutorial.

I have five buttons which use the same openWinCentre function to open five popup windows.

Everything works fine but I have to close one popup window before clicking a button to open another.

For example, say I click button1 to open popup1, this works fine.
Then, if I click button2 to open popup2, nothing happens unless I close popup1 first.

At the moment I am only able to have one popup open at once - ideally I’d like to have all five open at the same time.

Could this be anything to do with the kryptic target_winName tag as I wonder whether all my popups have the same name / id?

I’ll be very grateful for all suggestions on this, thanks. :asian:

bump! -

I could genuinely use some help with this - please let me know if the original post wasn’t clear or if it’s something really obvious that i’ve missed.

Thanks

Just wanted to say that I came to the forum looking for the same answer… I tried changing the target_winName tag (as I’m sure you did) to no avail. Hopefully someone out there can help!!!

Hmm, try changing this…

Movieclip.prototype.openWinCentre = function (url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) { 
	getURL ("javascript:var myWin; if(!myWin || myWin.closed){myWin = 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 + "))+'" + "')}else{myWin.focus();};void(0);");
}

To this…

Movieclip.prototype.openWinCentre = function (url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) { 
	getURL ("javascript:myWin = 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 + "))+'" + "')");
}

No Clue if it will work, but it is worth a try right?

okay, I think I’ve finally found a solution. I recommend checking out http://www.xs4all.nl/~ppk/js/ where I found my javascript tips. The code which seems to work for me, tho I’m not exactly sure why is:

Movieclip.prototype.openWinCentre = function (url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) { 
getURL ("javascript:var myWin=''; if(!myWin || myWin.closed){myWin = 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 + "))+'" + "')}else{myWin.focus();};void(0);");
}

The only change is in setting the var myWin=’’ instead of just declaring it as var myWin. Apols for the icon that appears around the word void, ignore this.

Daedelus, if you’re still working on this, could you confirm whether or not the code works? Thanks.

Cool… I hope it works :slight_smile:

If not… you can use my method of centered pop up windows. The one I wrote and have been using for a long time and has never failed me :slight_smile: It involves you put code in your HTML page and call it in Flash… but it is better than nothing.

::check attachment if you want::

hmmm… I tried it out locally, and it doesn’t seem to work. Locally, it brings up a popup that says unable to open (javascript…blah blah). I’m gonna go get some breakfast and try some more stuff…