Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do the opposite

Status
Not open for further replies.

elan

IS-IT--Management
Apr 3, 2001
24
AU
I have the following that produces a popup window:
on (release)
{
getURL("javascript:window.open('pan1.html','pan1','toolbar=0,location=0,directries=0,status=0,menubar=0,scrollbars=0,resizable=0,width=460,height=450,left=0,top=0')");
}

I have also a couple of other windows called pan2 and pan3. How can I make pan2 or pan3 window close if I press for pan1 to popup?

with thanks

Brian
 
Add the following line to your event code:
Code:
winvar.close();
Note that in order to do this, you need to keep the window handle that is returned when you execute window.open.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Boy thant was quick Tracy

Many thanks

Brian
 
You're welcome. Unfortunately, it may not be as simple as I made it sound, since the code you showed does not return the handle of the window it opens. You may have to change the getURL code as well, or write your own function.

(P.S. It was quick because I have no life. I'm sitting here on TT at 11:45 PM [yawn])

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Sorry Tracy I have tried it out without success. I have the following in the html pages I have called up OnBlur="window.focus() to keep it ontop over my origianl page. Maybe that may have some effect on it.

Can you post an example of the additional code to close pan2.html and pan3.html. Your comment "need to keep the window handle that is returned when you execute window.open" has me rather confused as I'm a javscript nubbie.

with thanks

Brian

 
I need more info before I can go any further. I can't find a reference to getURL that I'm sure applies to you situation. Do you know where the getURL function is declared (i.e. do you have any code that has "function getURL(..." in it)? Also I'm not sure about the (?) event "on (release)". Hopefully someone else here will recognize where these come from and we will be able to expand on my answer for you.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
No the code
on (release)
{
getURL("javascript:window.open('pan1.html','pan1','toolbar=0,location=0,directries=0,status=0,menubar=0,scrollbars=0,resizable=0,width=460,height=450,left=0,top=0')");
}

is set within a swf file. On press of the button pan1.html pops up at 0,0. The only html in pan1 starts the swf file in the window.

The only other code I have in another button is on (release)
{
getURL("javascript:window.open(\'pan2.html',pan2,'width=700,height=380,resizable=no,scrollbars=no,toolbar=no,top=\'+((screen.availHeight/2)-(300/2))+\',left=\'+((screen.availWidth/2)-(300/2))+\'\');void(0);;void(0)");
}

but that opens pan2.html in the middle of the page.

with thanks

Brian
 
Sorry, I don't know enough about SWF to be able to tell you how to fix the problem. Let me sleep on it (it's 1:23 AM here) and maybe I'll think of something if noone else here has a suggestion.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 

As Tracy says, to close windows that you have already opened, you will need to store a handle to them. While I have no idea about the scope of the variable that is returned (or more specifically, what happens to it when control returns to Flash), try this:

Code:
getURL("javascript:var winHandle = window.open(...);

to get a handle to the window you open, and then use the close method as described by Tracy to close it.

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Tracy and Billy many thanks.

Solved the problem by just applying a wee bit of logic and your good comments above.

A good nights sleep does help!

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top