# POP up

**URL:** <https://forum.kirupa.com/t/pop-up/25651>\
**Category:** flash\
**Created:** [July 15, 2003, 12:36pm UTC](https://forum.kirupa.com/t/pop-up/25651 "2003-07-15T12:36:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![swift7777](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@swift7777](https://forum.kirupa.com/u/swift7777)\
**Post date:** [July 15, 2003, 12:36pm UTC](https://forum.kirupa.com/t/pop-up/25651/1 "2003-07-15T12:36:44Z")

</div>

I’m using the kirupa popup script thats inbeded in flash as apposed to on an html page, can anyone help a scripting novice with the code to close this sucker.

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);”);  
}

sooo, when I press release on another button the current popup close’s and a new window replaces it.

thanx 4 any help,

swift.:block:

---

<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:** [July 15, 2003, 1:21pm UTC](https://forum.kirupa.com/t/pop-up/25651/2 "2003-07-15T13:21:13Z")

</div>

This is just a guess, because I’ve never used the script outside of HTML, but can you use this from inside the popup window:

on(release){  
getURL(“javascript:window.close();”);  
}

I’m at work, otherwise I would give a quick test run. Let me know if that works for you!!

---

<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:** [July 15, 2003, 2:54pm UTC](https://forum.kirupa.com/t/pop-up/25651/3 "2003-07-15T14:54:03Z")

</div>

Thanx 4 reply,

This one is quite tricky,  
because the button contains a function call, the function is scripted in a frame, in the function script is the getUrl javascript call.

So what I’m trying to figure is where in the function can you put a javascript call that will close the top most window, because the button to close the popup is in the window below.

Any help would be great.

Cheers,

swift.

---

<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:** [July 15, 2003, 2:55pm UTC](https://forum.kirupa.com/t/pop-up/25651/4 "2003-07-15T14:55:59Z")

</div>

all the above script is in the first frame of my swf.

on (release) {  
//customize the window that gets opened  
// 0 equals NO.  
// 1 equals YES.  
address = “caveman.html”;  
target\_winName = “caveman”;  
width = 374;  
height = 242;  
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);  
}

all of this script is in the button that calls to the function that opens the popup.

swift.
