Not that I'm aware of. Javascript alert is the only way to block a page close, 
and even then only until the user clicks OK. The various close-related events 
in Javascript exhibit subtle differences across browsers/versions and allowing 
a script to force a page to remain open (for any length of time 
programmatically including potentially indefinitely) would be a serious 
security and usability issue.

Best,
Seth

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of wkolcz
Sent: Tuesday, December 09, 2008 10:40 AM
To: [email protected]
Subject: RE: [flexcoders] Call Flex from JavaScript

Unfortunately that is not an option. This is a video player tracking system on 
a very public landing page.

Would onbeforeunload work better? Is there a way to just delay the closing of a 
page before it happens (behind the scenes)?

Any other javascript events that would work better?
________________________________________
From: Seth Hodgson <[EMAIL PROTECTED]>
Sent: Tuesday, December 09, 2008 10:32 AM
To: "[email protected]" <[email protected]>
Subject: RE: [flexcoders] Call Flex from JavaScript
You need to pop a Javascript alert in your trackClosing() method to keep the 
browser from closing until the user clicks the OK button.

This technique is a hack, but an alert generally leads to a long enough delay 
in user interaction (say a second or two) to finish making your call into the 
Player before the browser process exits.

Best,
Seth

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of wkolcz
Sent: Tuesday, December 09, 2008 10:26 AM
To: [email protected]
Subject: RE: [flexcoders] Call Flex from JavaScript

Based on that and other examples, I tried this:

<script language="JavaScript" type="text/javascript">
window.onunload = trackClosing;
function trackClosing(){
document.getElementById("FXVideo").tagWithClosed();
}

</script>

In my constructor I have:
if (ExternalInterface.available){
ExternalInterface.addCallback("tagWithClosed",windowClosed);
}

It doesn't seem to work. Any ideas on what I am doing wrong?

________________________________________
From: Seth Hodgson <[EMAIL PROTECTED]>
Sent: Tuesday, December 09, 2008 9:50 AM
To: "[email protected]" <[email protected]>
Subject: RE: [flexcoders] Call Flex from JavaScript
This page in the LCDS docset describes this specifically: 
http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/lcds/help.html?content=lcconnections_4.html#1074309

The scenario in the docs is dealing with notifying the server that the client 
is going away, in order to short-circuit the slower normal notification based 
on server session timeout. But you could use the same technique to achieve 
other things as well.

Best,
Seth

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of wkolcz
Sent: Monday, December 08, 2008 6:28 PM
To: [email protected]
Subject: [flexcoders] Call Flex from JavaScript

Using a set up in my ActionScript of:
ExternalInterface.addCallback("tagWithClosed",windowClosed);

How can I write a JavaScript function that calls 'tagWithClosed' to Flex when 
the user closes the window (window.close() ) or when they leave for another 
page?




Reply via email to