Have you tried a simple usecase (not using EI to roundtrip from Flex) ?
Something like:
<script>
var askFirst = false;
function preventerOn() {
askFirst = true;
}
function preventerOff() {
askFirst = false;
}
window.onbeforeunload = sureUnload;
function sureUnload() {
if (askFirst)
return "Are you sure you want to exit this page?";
}
</script>
<body onload="return preventerOn();">
On Sat, Oct 31, 2009 at 5:21 AM, jcarrera <[email protected]> wrote:
>
> I'm using SWFObject 2.2. Here's my sample JS:
>
> <script type="text/javascript">
> var vars = {};
> var params = { scale:'noScale', salign:'lt',
> menu:'false' };
> var attributes = { id:'testSWF', name:'testSWF' };
> // give an id to
> the flash object
>
> swfobject.embedSWF("myTest.swf", "flashContent",
> "100%", "100%",
> "9.0.0", "js/expressInstall.swf", vars, params, attributes );
> swfmacmousewheel.registerObject(attributes.id);
>
> function onbeforeunload_handler(){
> var message = testSWF.getUnloadHandlerMessage();
> //Flex App
> function called using ExternalInterface CallBack
> if(message != "")
> return message;
> }
>
> window.attachEvent("onbeforeunload",
> onbeforeunload_handler);
>
> </script>
> <style type="text/css" media="screen">
> html, body, #flashContent { height:100%; }
> body { margin:0; padding:0; overflow:hidden; }
> </style>
>
>
> Basically, I'm trying to alert the user that by navigating away from
> the page, they may lose unsaved work. So...when I navigate away I'm
> not alerted and my function is not called. Please Help!
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SWFObject" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/swfobject?hl=en
-~----------~----~----~----~------~----~------~--~---