PDA

View Full Version : Problem: Flex and focus() from Javascript


extreme911
06-10-2009, 04:04 PM
Hello,

Here is my problem.
I have 2 html pages.
2nd - Flexwindow.html

opener.html contains a javascript which is similar to this:
var window2 = window.open("Flexwindow.html", "MyWindow");

function focuswin()
{
window2.setBrowserFocus();
}

focuswin() function called by pressing a button.


Flexwindow.html contains a flex swf and a java script:

function setBrowserFocus(){
document.getElementById("MyflexObject").focus();
}

So basicaly when im starting Opener.Html it will automaticaly run my flexwindow.html in front of Opener.html (opener will be under the flex page) (and this working perfectly).

The problem that if i will bring opener.html in front by clicking on it, and then will click the button with focuswin(), it will bring back in front my flexwindow.html (thats what i actualy needed) but it WILL AUTOMATICALY REFRESH SWF to it initial state (and thats what i dont need).
How i can stop refreshing this swf caused by javas focus() function?

Thank You

wvxvw
06-10-2009, 06:10 PM
Save the previous state in SharedObject? Use SWFAddress to remember the last state? Save state to the opener page and pass it as the parameter to flex window when you open it?
window.open() creates a new window, the browser may reuse the previously opened one, but it should reload the content of the window - that's unavoidable as that is the behaviour expected from window.open().