Some JavaScript in FLash problems

Trying to launch a popup window.

button code:
[AS]on (release) {
getURL(“javascript:openNewWindow(‘news.htm’, ‘_blank’,‘height=400,width=550,toolbar=no,scrollbars=no’)”);
}
</script>[/AS]

html code:
[AS]<script language=“JavaScript”>
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
newWindow=window.open(URLtoOpen, windowName, windowFeatures);
}[/AS]

I get a error every time and no popup loads. Any ideas?

I don’t know, but why not use the tutorial here?

Because I’m lazy, I would just put:


getURL("java/script:window.open('news.htm','news','=400,width=550,toolbar=no,scrollbars=no');");

The second thing in the javascript is the new window’s name, not target - but I don’t think that would stop it from working

The one here blocks mutliply winodws form beeing open and error’s if you use any spaces in your title.

With your chages do i have to chage the HTML code?

i have the code on the news button here
http://www.sintax321.com/stc/stc.html
you cna see i get an error every time.

:bump:

You wouldn’t use the code in HTML because window.open will work by itself.

The reason that you can’t open multiple windows with the tutorial here is because that second atribute in the javascript code is the new window’s name. If you change that second atribute for each code set, then it will open multiple windows.

Hang on…I’ll make a fla :stuck_out_tongue:

thanks freddy

You bet - here’s what I did:
http://www.freddythunder.com/test/sintax.html

Each of the three windows has a unique window name ‘pic1’,‘pic2’, and ‘pic3’. The AS in the tutorial had to be doctored a little because before it checked for the variable from the button ‘myWin’ if it had been activated - well I got rid of all that!! :evil:

I also added top and left as locations instead of them all being centered - you’ll see all that crap in the code.

Umm…I don’t know what you meant by ‘spaces in your title’. Do you mean the title of the window that you’re opening? Beacuse that’s done in the html code that you are opening, ie, you open sintax.html that has HTML code that starts like:


<head>
<title>This is sintax.html - so there!</title>
</head>
<body>
//etc etc...

I think that should about do it for ya? Yeah? Anything else lemme know - and thanx for making me a pixel Kirupian!!!:stuck_out_tongue:

thanks a ton man. I’ll lplay around and see how things go.