|
-
centre screen pop-up
Now I've worked out how to get the pop-up window to work i now want the pop-up to appear centre screen as apposed to the top left the code on the button is below but what do i need to alter to achieve this.
on (release) { getURL("javascript:window.open('image1.html','imag e1','width=500,height=500,top=0,left=0,toolbar=no, scrollbars=yes,resizable=no,menubar=no,status=yes, directories=no,location=no'); void(0);");
}
-
Product Designer
before the void() action you should add something like this...but I can't remember exactly the window dimension variables:
Code:
moveTo(screen.width/2-window.width/2,screen.height/2-window.height/2);
By the way, IE and NN work in a different way, and produce different results, you should make a dispatcher and develop a code for each system, including Mac support....
Altruism does not exist. Sustainability must be made profitable.
-
Senior Member
insert this script into the head section of your html
<*script language="javascript">
function a(){
var leff = (screen.width - 600) / 2
var topp = (screen.height - 300) / 2
window.open('image1.html','one','left=' + leff + ' top= ' + topp + ' width=600 height=300')
}
<*/script>
then for the geturl action use this
on (release) {
getURL("javascript:a()");
}
nObOdY dIeS A vIrGiN,
LIfE sCrEwS uS aLL
-
Registered User
Here's a version from catbert that worked first time, and I had never done one before. In the head of the html page that holds the main movie, add:
Code:
<*script type="text/javascript">
<*!--
function openWindow(url,name,w,h) {
xPos = (screen.width - w) / 2;
yPos = (screen.height - h) / 2;
config = 'left=' + xPos + ',screenX=' + xPos + ',top=' + yPos + ',screenY=' + yPos + ',width=' + w + ',height=' + h;
newWindow = window.open(url, name, config);
}
//-->
</script>
In the button to open the popup, add:
Code:
on (release) {
getURL("javascript:*openWindow('popup.html','newWin',600,500);");
}
The popup window size is set here. Whatever size it is now, it will open center screen. You can change the size on the button, and the java on the main page will still center it. 
add; the forum doesn't like my code, so remove the *'s above when you copy.
Last edited by iaskwhy; 12-15-2002 at 04:03 PM.
-
Thanks all for the advice but is there anyway i can accomplish the centre screen pop-up without having to add anything to the html file and do it all directly from within flash as i did with the pop-up.
Cheers
Mark
Sunderland 2 Liverpool 1 Fantastic!!
-
Really this is me.....
Originally posted by markm73
Thanks all for the advice but is there anyway i can accomplish the centre screen pop-up without having to add anything to the html file and do it all directly from within flash as i did with the pop-up.
Cheers
Mark
Sunderland 2 Liverpool 1 Fantastic!!
You could try this but you will need the macromedi extension manager to use it:
PopUp Component
Extension Manager
Hope this can help you.
Mental
-
 Originally Posted by Ask The Geezer
Here's a version from catbert that worked first time, and I had never done one before. In the head of the html page that holds the main movie, add:
Code:
<*script type="text/javascript">
<*!--
function openWindow(url,name,w,h) {
xPos = (screen.width - w) / 2;
yPos = (screen.height - h) / 2;
config = 'left=' + xPos + ',screenX=' + xPos + ',top=' + yPos + ',screenY=' + yPos + ',width=' + w + ',height=' + h;
newWindow = window.open(url, name, config);
}
//-->
</script>
In the button to open the popup, add:
Code:
on (release) {
getURL("javascript:*openWindow('popup.html','newWin',600,500);");
}
The popup window size is set here. Whatever size it is now, it will open center screen. You can change the size on the button, and the java on the main page will still center it.
add; the forum doesn't like my code, so remove the *'s above when you copy.
Re. the Catbert solution provided by Ask The Geeza: I can't seem to get this to work.
Please confirm that the following code goes between the <script></script> tags:
<*!--
function openWindow(url,name,w,h) {
xPos = (screen.width - w) / 2;
yPos = (screen.height - h) / 2;
config = 'left=' + xPos + ',screenX=' + xPos + ',top=' + yPos + ',screenY=' + yPos + ',width=' + w + ',height=' + h;
newWindow = window.open(url, name, config);
}
//-->
Grateful if you could clarify which elements of the code I need to customise and with what information?
Many thanks.
Rich
-
To clarify: I currently have this script on the button in the Flash movie:
on (press) {
getURL("javascript:NewWindow=window.open('comp_pop-up.html','newWin','width=520,height=808,left=20,to p=20,\toolbar=No,location=no,scrollbars=yes,status =no,resizable=yes,fullscreen=no'); NewWindow.focus();\r void(0);");
}
Only thing wrong with this is that it doesn't x and y centre the pop-up window.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|