Hi Team,
I have a question
about calling a flex method from JS.
The
scenario is, if the user closes the window without logging off, I detect the
window close from JS and call the appropriate logoff mechanism which is mapped
originally for log out button.
JS code
<SCRIPT LANGUAGE="JavaScript">
window.onbeforeunload = clean_up;
function clean_up()
{
var flex = document.${application} || window.${application};
flex.myFlexFunction();
}
And in the
Flex application I code –
import flash.external.ExternalInterface;
ExternalInterface.addCallback("myFlexFunction",cleanUp);
public function cleanUp():void{
//do the dirty work
........................
.........................
This codes
are taken from http://board.flashkit.com/board/showthread.php?t=748226
But I find
no action being detected. My html wrapper for the application has no visual
elements. The whole functioning of the application is entirely in flex. The
HTML is just a wrapper for it.
Its not
working for me. Any views?
Cheers,
Venkat.