PDA

View Full Version : how do you make a center pop up window in flash???


chaego
09-27-2003, 07:55 PM
ok i kno im a real newbie for askin this and i kno its in the tutorial section but how do you make a pop up window that centers itself

javascript:openNewWindow('somePage.html','thewin', 'height=100,width=250,toolbar=no,scrollbars=yes');

<script language="JavaScript">
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
newWindow=window.open(URLtoOpen, windowName, windowFeatures);
}
</script>


what do i put? to make the window center it self when it pops up?

Warrior
09-28-2003, 11:56 PM
I answerd this before but don't know if it's you...:rolleyes:

Put this code on the frame of where the button is
wdth = "700"; // Width
hdth = "450";// Height

Put this code on the button

on (release) {
getURL ("javascript:window.open('index-1.html','nName','width=" add wdth add ",height=" add hdth add ",top='+((screen.availHeight/2)-(" add hdth/2 add "))+',left='+((screen.availWidth/2)-(" add wdth/2 add "))); void(0);");
}

JGizmo
09-29-2003, 12:29 PM
DOH ME :D

chaego
09-29-2003, 03:42 PM
thanks alot :D

Warrior
09-29-2003, 05:05 PM
You're welcome :D

One problem is I don't know how to add the scrollbar or allow the toolbar. Do you know JGizmo?

Xenozip
09-29-2003, 06:07 PM
window.open(site,"newwindow","toolbar=0,location=0,directories=0,status=0,menuba r=1,scrollbars=1,resizeable=1,width=600,height=450")

using your method, it would be like this :

wdth = "700";
hdth = "450";

on (release) {
getURL ("java script:window.open('index-1.html','nName',toolbar=0,location=0,directories=0 ,status=0,menubar=1,scrollbars=1,resizeable=1,'wid th=" add wdth add ",height=" add hdth add ",top='+((screen.availHeight/2)-(" add hdth/2 add "))+',left='+((screen.availWidth/2)-(" add wdth/2 add "))); void(0);");
}

Warrior
09-29-2003, 07:50 PM
You tried it and it worked, right? Thanks for that :D :cool:

Xenozip
09-29-2003, 09:24 PM
Originally posted by Warrior
You tried it and it worked, right? Thanks for that :D :cool:
Well, when I tried it your way, I got a syntax error.
When I tired it his way, it screwed up.

Then, I tried it this way :

on (release) {
wdth = "700";
hdth = "450";
getURL("java script:window.open('index-1.html','newwindow',toolbar=0,location=0,directori es=0,status=0,menubar=1,scrollbars=1,resizeable=1, 'width=" add wdth add ",height=" add hdth add ")");
}

Didn't get a syntax error with that (in flash, or in IE), but I get a 404 page not found.
Too lazy and tired right now to figure out why it's not found. -.-

Warrior
09-29-2003, 11:09 PM
It's because yo have to change this part in the code to your own HTML file

getURL("javascript:window.open('index-1. html')