PDA

View Full Version : Close pop up centered Window


ROYOW
02-24-2006, 07:06 PM
Hello all,

Does anyone know how to close the pop up centered window? I have been looking for the information but none of the code I found works. I hope some experts can help me out. Thank you for your help in advance!

http://www.kirupa.com/developer/mx/centered_popup.htm

Cota
02-24-2006, 07:11 PM
From within the popup, a button with this code getURL("javascript:window.close();")" I think thats it.

ROYOW
02-24-2006, 07:28 PM
Hi Cota,

Thank you for your help but the code didn't work. It was weird that the pop up page itself was close but the window remained and showed the page you click the pop up window. I hope you know what I meant. I do not really need a centered pop up window. Is there anyway I can have a pop up window and the button (in the pop up window) can close the pop up window?

I know it's not hard..but having trouble to make it work..

Cota
02-24-2006, 07:48 PM
I'm not following. You say the Popup window itself would close?

ROYOW
02-24-2006, 07:57 PM
Hi Cota,

I'm referring the content itself. When the button in the pop up window was executed, the content in the pop up window was closed and changed to the page where you click the pop up window, but the window itself was still there. Do I make sense to you? I'm sorry that i am unable to upload the files because they are over-sized.

tg
02-24-2006, 08:11 PM
post the code for poping up the window


if you give the popup window a name when it is created, you can target that named window to close it.

ROYOW
02-24-2006, 10:04 PM
In the keyframe:

_root.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);");
}


Attach to the button:

on (release) {
//customize the window that gets opened
// 0 equals NO.
// 1 equals YES.
address = "yourfile.html";
target_winName = "filename";
width = 400;
height = 300;
toolbar = 0;
location = 0;
directories = 0;
status = 0;
menubar = 0;
scrollbars = 1;
resizable = 0;
//sends data back to the function
openWinCentre(address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);
}

Cota
02-24-2006, 10:21 PM
Are you saying, in the popup window, the content disappears, but the window stays?

ROYOW
02-24-2006, 11:47 PM
Yes, Cota.

But the stayed window is not blank. In the window, you will see the page where you trigger the pop up window. Let say I have a page A and page B. When I click the button on page A, page B pops up. What I am going to do is to close page B. When clicking the close button (attached with your AS code) on page B, page B disappears but page A shows up in the pop up window. I hope my stupid example can help you understand the problem better. :o

oldnewbie
02-25-2006, 03:12 AM
http://www27.brinkster.com/oldnewbie/actionscripts/popup.html :D

ROYOW
02-27-2006, 04:03 PM
Hello oldnewbie,

Your example is what I want to achieve in my project. Would you please post your code or documents? Thank you so so much in advance!

Best,
Royow:)

oldnewbie
02-28-2006, 05:01 PM
Just mailed you the files!