PDA

View Full Version : pop-up window script help



snakekiller
February 19th, 2003, 08:41 AM
What would you add to this script to be able to keep the scrollbars? This opens a pop up but not resizable and without scrollbars.


on (release) {
uUrl = "http://the url of the html you want to open";
wdth = "the width you want";
hdth = "the height you want";
getURL ("javascript:window.open('"add uUrl add" ','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);");
}

Stephen
February 20th, 2003, 05:48 AM
This is untested but to open a new window using javascript you would add scrollbars=yes to the code

snakekiller
February 20th, 2003, 08:36 AM
right,
But where? I've tried putting it in amost every spot in that code.

Mr. Twinkles
February 21st, 2003, 12:44 AM
Try something like this:
getURL(javascript:openNewWindow('http://www.macromedia.com','myWindow', 'height=400,width=400,toolbar=no,scrollbars=yes');

And of course you can replace the URL stuff with your variables, but that's the basic syntax of it. Broken down, it goes like this...

getURL(javascript:openNewWindow(URL,WindowName,Win dowAtrtributes);

Hope this helps.

Mr. Twinkles
February 21st, 2003, 12:45 AM
Hehe...you also need some javascript on the page.

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

Sorry.

Mr. Twinkles
February 21st, 2003, 12:46 AM
//<script language="JavaScript">
//function openNewWindow(URLtoOpen, windowName, //windowFeatures) {
//newWindow=window.open(URLtoOpen, windowName, //windowFeatures); }
//</script>
It's not letting me post this...trying to comment it.

Mr. Twinkles
February 21st, 2003, 12:47 AM
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
newWindow=window.open(URLtoOpen, windowName, windowFeatures); }

all this goes inside the script tags. Sorry for the multiple posts.

Mr. Twinkles
February 21st, 2003, 12:50 AM
Looking back, I could have answered your question a lot quicker. You just need the scrollbar attribute in commas in the the third section. AHHH!!! CONFUSION!!!

snakekiller
February 21st, 2003, 08:28 AM
Mr. Twinkles,

Please show me where you are talking about putting the scrollbar=yes code.
Like I said, I've tried putting it in every spot in that code with no results.

Snake

Mr. Twinkles
February 21st, 2003, 09:54 AM
try this. In the flash movie, put this code:

on(release){
getURL("javascript:myPopup();");
}

in the html page, put this in the head section between script tags.

function myPopup(){
myURL = "http://www.google.com"
window.open('http://www.google.com', 'mywindow','toolbar=yes,scrollbars=yes,location=ye s,statusbar=yes,menubar=yes,resizable=yes,width=40 0,height=300,left = 300,top = 200');
}

and you can edit all the attributes. I'm pretty sure you can put everything in the flash movie, but this could be easier. You can set it up to where everything is a variable if you'd like, and then just pass the variable in flash like:
getURL("javascript:myPopup(URL,toolbar,scrollbar,etc)");
just make sure you change the myPopup function in the html page to accept the variable within the window.open(); part of it.

Hope this works for you.

snakekiller
February 21st, 2003, 11:01 AM
thanks,

but I was trying to avoid any html script.

thanks for your time anyway.

Snake

Mr. Twinkles
February 21st, 2003, 11:08 AM
Ok, here's the same deal without any html. When you test this in flash, use Ctrl + F12 to test in the browser. That way it doesn't pop up the extra window like Ctrl + Enter will. Anyway, here's the code:

on (release) {
getURL("javascript:window.open('http://www.google.com','MyWindow','toolbars=no, scrollbars=yes, resizable=no, width=200, height=500, menubar=yes, left=300, top=500')");
}

Sorry for not getting this how you wanted sooner. Have fun.

snakekiller
February 21st, 2003, 11:39 AM
Ah, ok
So the left= and top= specify where the window opens on the x-y axis?

thanks man.