all groups > flash actionscript > march 2006 >
You're in the

flash actionscript

group:

getURL window


getURL window LSNsaltlamp
3/28/2006 11:21:39 PM
flash actionscript:
I am trying to use the getURL command to open a new window with set dimentions.
The code I am using is:


getURL("javascript:window.open('http://www.google.com','mywindow','width=400,hei
ght=200')")

This code works with one exception. The origanal page changes to read: How do
I keep the first page from changing?
Re: getURL window jessedudan
3/29/2006 3:48:01 AM
Try this code instead of using the javascript action. This code gives you much
more control over the new window, and I have never had a problem with it.

Add this to the button.

on (release) {
address = "../pages/mountain_design.html";
target_winName = "mountain";
width = 722;
height = 475;
toolbar = 0;
location = 0;
directories = 0;
status = 0;
menubar = 0;
scrollbars = 1;
resizable = 1;
openWinCentre(address, target_winName, width, height, toolbar, location,
directories, status, menubar, scrollbars, resizable);
}

Use 0 or 1 to make each variable fales or true (respectively).

And then add this global function on the first frame of the root of your swf.

_global.openWinCentre = function(url, winName, w, h, toolbar, location,
directories, status, menubar, scrollbars, resizable) {
getURL("javascript:window.open('"+url+"','"+winName+"','"+"width="+w+",
height="+h+",toolbar="+toolbar+",location="+location+",directories="+directories
+",
status="+status+",menubar="+menubar+",scrollbars="+scrollbars+",resizable="+resi
zable+",
top='+((screen.height/2)-("+h/2+"))+',left='+((screen.width/2)-("+w/2+"))+'"+"')
; void(0);"); };

Hope this helps. This code should not effect the parent window.
AddThis Social Bookmark Button