Is there an instance where anyone would want to have a navigation menu in a browser window separate to the main content window? Probably not - it’s invariable better to keep the menu with the content.
Advantages would arise if someone couldn’t use PHP and didn’t want to repeat their navigation menu in every page (making changes a lot of work) or if the design necessitated the content takes up 100% of each page.
Anyway I worked out how it’s done before deciding it was a bad idea so here’s the code:
Basic linking to the parent window from flash in a pop-up (child) window
1. Create pop-up window.
First you have to create a page for the pop-up window. (pop-up-window.html in this example): Then from the main page you make the menu window spawn automatically or create a ‘menu button’ to bring up the menu using JavaScript.
This can be done from flash if the main window is pure flash with the Get URL action:
on (release) {
getURL ("javascript:NewWindow=window.open
('popupwindow.html','newWin',
'width=550,height=400,left=0,top=0,toolbar=No,location=No,
scrollbars=No,status=Yes,resizable=No,fullscreen=No');
NewWindow.focus(); void(0);");
}
More options are given by Jeffery Hill at:
http://www.flashkit.com/tutorials/Jeffery…
2. Linking between the pop-up window and your main Parent page.
Use this javascript code in (the of) your pop-up window:
function updateParent(newURL) {
opener.document.location = newURL
}
3. Add the action to the button in your flash menu.
Create an instance of a button using Insert - >New symbol. (You’ll need a new button for every page in the website so for a large site use any of the flash menus available to make a better system.)
Add the following address as part of a getURL action to your flash button:
"javascript:updateParent('page2.html')"
i.e. - Select the button in flash and add the actionscript in the actions box:
on(release) {
getURL("javascript:updateParent('nextpage.html')");
}
note: page2.html is the html page that will appear in your parent window (or target frame)
4. That’s it, although I recommend changing the focus back to your main window - i.e. The parent window comes to the forefront after the page is changed.
Use this javascript code in (the of) your pop-up window:
function updateParent(newURL) {
opener.document.location = newURL;
timoutID=setTimeout("focusMain()",100)
}
function focusMain(){
opener.document.focus();
clearTimeout(timeoutID)
}
note: If you’re using frames in your document the ‘Parent’ page is the frame which spawned the pop-up window.
5. That really is it, although I recommend having a cup of tea now.