PDA

View Full Version : changing focus between windows


isomega1
08-05-2004, 03:00 PM
I need to get two separate flash movies in two separate windows to communicate, this is the set up:
A movie in the main window calls a pop up win which contains a quiz swf, I need a button on this quiz which will cause this window to minimise without refreshing etc. I then need a button in the other swf in the main window to maximise this pop up swf without reloading or refreshing it so that a partially filled out quiz can be revisited as required. Basically I need to recreate the effect of Alt + tab between the two windows with flash buttons....
whats the action script I need on the buttons?

thanx for any sugestions???

i. :confused:

tg
08-05-2004, 03:29 PM
focus() is one way to do this:

popupWindowName.focus();
this will give focus to the popup window

then on the popup window you would have :
opener.focus(); (opener is a keyword representing the window the opened the popup).

tg
08-05-2004, 04:05 PM
here is some code:

<script type="text/javascript">
var pops;
function popit(){// this opens the popup.
var params="width=200, height=200, toolbar=no, statusbar=no, resizable=no";
pops=window.open('mypop.html','pops',params);
}
function switchWithPops(){
pops.focus();// this actually gives focus to the popup - called from flash
}
</script>

this script goes on the html page that has your 'main' flash file embedded in it.

this would be the code inside your 'main' flash file:

btn.onRelease=function(){
getURL("javascript: pops.focus();");
};

delay=function(){
getURL("javascript: popit();");
clearInterval(inter);// turn off the delay.
}
//built in delay: delay popup for 1 second.
var inter=setInterval(delay,1000);


now here is the code for the 'popup' flash file:

btn.onRelease=function(){
getURL("javascript: opener.focus()");
};