Pop-up with different addy

I’m using the centered pop-up tutorial on this site, it works just fine. The problem is that if that pop-up is already open and I try to open another pop-up with the same script, but a different address, nothing happens. You have to close the first pop-up to get another one to launch.

FYI: I have a static layer with all of my menu buttons, this layer covers the entire movie. Some of the buttons change the frames in the movie and some open pop-ups.

I have the prototype script loaded into a blank frame on another layer that also covers the entire movie.

Does this make sense?

How do I open two pop-ups with this script, without the user having to close the first?

Thanks,
'pos

I can’t explain it too well because I don’t know too much about javascripting, but I do know that you can’t open multiple windows with that popup tut because everything will point to that window (I think it’s called ‘myWin’). In the beginning of the javascript it asks if ‘myWin’ is closed.

Thank you. Seems to make sense. Hopefully some wise soul will pop in with a solution.

Cheers,

'pos

yeah… you can modify the script a bit and it should open any number of popups.

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

=)

Kax,

Thank you. It works perfectly.

'pos

no problem. :wink: =)

That code, wont work 4 me, Flash keeps telling me that i hav a syntax problem

hmmm…testing!

Kax code should work

Originally posted by samoscratch
hmmm…testing!

… testing what!? :stuck_out_tongue:

sorry…my avatar and pictures…

how to make the code work?sorry,hope you bear with me on this one, i’m a newbie…

http://www.kirupa.com/developer/mx/centered_popup.htm

all you have to do is replace the code provided in the tutorial with the code i posted.

kax, i replaced my code wit urz with a few personalisations, here it is

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

im still gettin an error message

yeah… i’m still waiting for your FLA. :stuck_out_tongue:

you’re supposed to replace the code in the frame actions, not the code in the Button.

that is, instead of this code:

Movieclip.prototype.openWinCentre = function (url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) { 
	getURL ("java****script:var myWin; if(!myWin || myWin.closed){myWin = window.open('" + url + "','" + winName + "','" + "width=" + w + ",height=" + h + ",toolbar=" + toolbar + ",location=" + location + ",directories=" + directories + ",status=" + status + ",menubar=" + menubar + ",scrollbars=" + scrollbars + ",resizable=" + resizable + ",top='+((screen.height/2)-(" + h/2 + "))+',left='+((screen.width/2)-(" + w/2 + "))+'" + "')}else{myWin.focus();};void(0);");
}

you use this one:

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

o thnx its definitely better than what I had b4 but it still doesnt work perfect cuz instead of getting a completely new pop up each time i click something in my menu, it just refreshes the old one wit the new page. :frowning:

are you using the same name for all the popup windows (the winName parameter)??

that’s the only reason i can think of.