# Help needed with centred pop up windows

**URL:** <https://forum.kirupa.com/t/help-needed-with-centred-pop-up-windows/202725>\
**Category:** flash\
**Created:** [October 4, 2006, 9:06am UTC](https://forum.kirupa.com/t/help-needed-with-centred-pop-up-windows/202725 "2006-10-04T09:06:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![spindrift](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@spindrift](https://forum.kirupa.com/u/spindrift)\
**Post date:** [October 4, 2006, 9:06am UTC](https://forum.kirupa.com/t/help-needed-with-centred-pop-up-windows/202725/1 "2006-10-04T09:06:23Z")

</div>

Hi guys,

Thanks for the interest in my post…

I am opening centred pop up windows with Flash for a gallery so when you click on a thumbnail, it brings up the centred pop win.

Unfortunately, if the user opens a pop up window, they have to close it in order to open another one. What I want to happen is if the user has a pop up window already open and selects another thumbnail from the gallery, the pop up window is replaced by the new one, meaning the user won’t have to close a pop win.

Is this do-able with the code I’m using?

```auto
_root.contentMain.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);");

    }

```

…and…

```auto
on (release) {
    address = "gallery/large.php?image=041";
    target_winName = "gallery";
    width = 750;
    height = 493;
    toolbar = 0;
    location = 0;
    directories = 0;
    status = 0;
    menubar = 0;
    scrollbars = 0;
    resizable = 0;
    //sends data back to the function
    openWinCentre(address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);

    }

```

Thank you very much and I hope to hear from you.

All the best,

Mark
