Log in

View Full Version : Opening links in new window



maebeeso
05-28-2008, 01:13 AM
Hi, I have found a script that enables me to open my links from a button in flash to a new chromeless window. My question is...what if I have several buttons all going to other urls. Does anyone know how to do this?? thanks heaps.

Medyman
05-28-2008, 03:37 AM
I'm not sure I understand what you're trying to do. Do you want to open a new window for each of those links?

maebeeso
05-29-2008, 06:29 AM
I'm not sure I understand what you're trying to do. Do you want to open a new window for each of those links?
This is the code i found
function Launch(page) {
OpenWin = this.open(page, "My HomePage", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,width=550,height=250");
}
I have put the appropriate actionscript into flash. But what if i had several buttons on my flash page that all led to different url's and I wanted them to open in chromeless windows.
Sorry this may seem like a complicated way to explain. I'm obviously a novice trying to do weird things!!! :)

Medyman
05-29-2008, 03:07 PM
Assuming that you've written your ActionScript correctly, you would just pass a new URL to the Launch() function.

The page paramater of the launch function would be the URL of the page you're opening. So, if you have multiple buttons you can call them as such:


button1.onRelease = function() {
page = "http://www.google.com";
Launch(page);
}
button2.onRelease = function() {
page = "http://www.dynamicdrive.com";
Launch(page);
}

You are using AS2, right?

maebeeso
05-29-2008, 10:17 PM
Okay now I am totally confused. You have given me what looks like a very simple explaination and I still don't get it. I have used the getURL in actionascript 2 on my button and the above script in my html. Where am I putting what you have just given me and should I just forget the whole idea and open in a blank window!!! ?>@#

Medyman
05-30-2008, 01:00 AM
Ahh, no wonder you didn't post the ActionScript. I was going to ask you what you were using to link the buttons via ActionScript.

The code I provided above is all ActionScript. It belongs in Flash. I was assuming that you had turned that Launch() function into an AS function.

You could add that JavaScript (the code you posted) into your HTML and via the External API in Flash, control which buttons show up to which page. But that's a totally unnecessary and overly complicate route to take.

Instead you could, as I had wrongly assumed that you had done, convert the javascript into ActionScript. Perhaps with something like this:


function Launch(page) {
getURL ("javascript:NewWindow=window.open('" + page + "','newWindow','width=500,height=350,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=Yes,fullscreen=No'); NewWindow.focus(); void(0);");
}

Then you'll be able to use the code that I previously posted within the Flash file and it should all work well. Again, all the code that I'm posting should be within Flash.