Click to See Complete Forum and Search --> : Creating an auto link out of a popup
gecks
12-18-2002, 11:08 AM
Hi
I'm a little stuck with this one... What I have done so far is to use java to open a popup window that has a flash game in it from a main page.
Now what I want todo is when the player has run out of money/what ever, that the popup window closes its self down and uses the original window (the one where the link to the popup window was placed) and go to a different page in that browser window, any help would be really really appreciated..
If its been difficult trying to understand what I have written, I'm really sorry but my english is terrible.
Thanks alot GRANT
You use flash in your window? When the player looses or anything else the window should close and the parent window goes to another location, am I right?
You can call from flash a javascript function like:
<script language="javascript">
function closeandlocate()
{
var w = window.opener;
w.location.href = "newpage.html"; // the page where parent window have to locate
window.close();// closes the actually window
}
</script>
I don't know how to call the function in flash, but I know it's possible
gecks
12-19-2002, 01:56 AM
Originally posted by swon
You use flash in your window? When the player looses or anything else the window should close and the parent window goes to another location, am I right?
You can call from flash a javascript function like:
<script language="javascript">
function closeandlocate()
{
var w = window.opener;
w.location.href = "newpage.html"; // the page where parent window have to locate
window.close();// closes the actually window
}
</script>
I don't know how to call the function in flash, but I know it's possible
:) thanks Swon, I'll have to research a little bit, but thats great.. thanks
gecks
12-19-2002, 07:48 AM
Originally posted by gecks
:) thanks Swon, I'll have to research a little bit, but thats great.. thanks
Cool.... I've found a way to do it but without goign through the flash,
<b>Within the original window: </b>
<script language="JavaScript"><!--
function newWindow(file,window) {
msgWindow=open(file,window,'resizable=no,width=200,height=200');
if (msgWindow.opener == null) msgWindow.opener = self;
}
//--></script>
<form>
<input type="button" value="Open New Window" onClick="newWindow('a.html','window2')">
</form>
<b>Within the new window:</b>
<script language="JavaScript"><!--
function load(file,target) {
if (target != '')
target.window.location.href = file;
else
window.location.href = file;
}
//--></script>
<a href="javascript:load('b.html',top.opener)">load document into opener</a>
<p>
<a href="javascript:load('b.html','')">load document</a>
but now I have a different problem. that when trying this function in a frameset it doesn't work and I imagine that is due to that fact that the opener for a frame isn't the same as the opener for a window. is there a way to change the target?
Gecks::confused:
Back again,
for frames you must give the frame-specified name:
if you have 2 frames for example:
<frame name="top" src="topsite.php">
<frame name="main" src="mainsite.php">
the top frame is called by:
var t = parent.top; //as the name of the topframe
//not sure, maybe var t = window.opener.parent.top; check it out!
t.location.href = "newlocation.php";
the same for the main frame
I think that could works!