# Open multiple popup windows at once?

**URL:** https://forum.kirupa.com/t/open-multiple-popup-windows-at-once/9079
**Category:** flash
**Created:** [December 4, 2002, 12:30pm UTC](https://forum.kirupa.com/t/open-multiple-popup-windows-at-once/9079 "2002-12-04T12:30:54Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![new2mx](https://avatars.discourse-cdn.com/v4/letter/n/3da27b/32.png) [@new2mx](https://forum.kirupa.com/u/new2mx)
#### Post date: [December 4, 2002, 12:30pm UTC](https://forum.kirupa.com/t/open-multiple-popup-windows-at-once/9079/1 "2002-12-04T12:30:54Z")

</div>

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:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [December 5, 2002, 2:26pm UTC](https://forum.kirupa.com/t/open-multiple-popup-windows-at-once/9079/2 "2002-12-05T14:26:07Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [December 6, 2002, 6:43am UTC](https://forum.kirupa.com/t/open-multiple-popup-windows-at-once/9079/3 "2002-12-06T06:43:16Z")

</div>

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!!!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [December 6, 2002, 6:51am UTC](https://forum.kirupa.com/t/open-multiple-popup-windows-at-once/9079/4 "2002-12-06T06:51:16Z")

</div>

Hmm, try changing this…

```auto
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…

```auto
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?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [December 6, 2002, 1:04pm UTC](https://forum.kirupa.com/t/open-multiple-popup-windows-at-once/9079/5 "2002-12-06T13:04:38Z")

</div>

okay, I think I’ve finally found a solution. I recommend checking out [http://www.xs4all.nl/~ppk/js/](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:

```auto
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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [December 6, 2002, 5:29pm UTC](https://forum.kirupa.com/t/open-multiple-popup-windows-at-once/9079/6 "2002-12-06T17:29:19Z")

</div>

Cool… I hope it works 🙂

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 🙂 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::

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [December 6, 2002, 5:45pm UTC](https://forum.kirupa.com/t/open-multiple-popup-windows-at-once/9079/7 "2002-12-06T17:45:27Z")

</div>

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…
