http://jira.openlaszlo.org/jira/browse/LPP-8771    :)

The javascript method is window.onbeforeunload instead of
beforeonunload  (the "on" is at the beginning)

On Wed, Feb 17, 2010 at 1:51 PM, Max Carlson <[email protected]> wrote:
> I think you'd want:
>
> <script type="text/javascript>window.beforeonunload=function(e) {
>       value = lz.embed.lzapp.callMethod('canvas.shutdown()')
> }
> </script>
>
> provided your application ID is 'lzapp'.  To be sure you could do this to
> call 'canvas.shutdown()' on all running apps:
>
>
> <script type="text/javascript>window.beforeonunload=function(e) {
>       value = lz.embed.callMethod('canvas.shutdown()')
> }
> </script>
>
> I hope this helps.  Please remember to file a JIRA improvement so we can fix
> this formally!
>
> Regards,
> Max Carlson
> OpenLaszlo.org
>
> On 2/17/10 4:54 AM, Lucas Lain wrote:
>>
>> Hello Max,
>>
>> Thank you for your answer. Let me see If I got you straight
>>
>> I should use something like this in the html:
>>
>> <script type="text/javascript>window.beforeonunload=function(e) {
>>       value =
>> lz.embed.lzapp.callMethod('globalreference.reference.shutdown()')
>> }
>> </script>
>>
>> And implement the "shutdown" method on my canvas?
>>
>> Thanks in advance.
>>
>> Lucas.
>>
>>
>> On Tue, Feb 16, 2010 at 7:47 PM, Max Carlson<[email protected]>  wrote:
>>>
>>> Hi Lucas,
>>>
>>> It sounds like the platform should include a workaround for this - can
>>> you
>>> file an improvement request in http://jira.openlaszlo.org/ ?
>>>
>>> In the mean time, you should be able to call into your app with the
>>> callMethod() or setCanvasAttribute() APIs documented here:
>>>
>>> http://labs.openlaszlo.org/trunk-nightly/my-apps/copy-of-hello.lzx?lzr=swf8&lzt=deployment
>>>
>>> I'd probably create a canvas method that iterates through the currently
>>> open
>>> connections and calls close on them.
>>>
>>> Just click the 'Server' button in the dev console to get details.  Let me
>>> know if you have questions!
>>>
>>> Regards,
>>> Max Carlson
>>> OpenLaszlo.org
>>>
>>> On 2/16/10 9:03 AM, Lucas Lain wrote:
>>>>
>>>> Hello everybody,
>>>>
>>>> Looking on the web, I found this solution to implement the
>>>> NetConnection shutdown before the browser window is closed.
>>>>
>>>> I'm trying to modify mediastream.lzx to include the actionscript part,
>>>> so I can reuse it in the future (maybe you can include it in the next
>>>> version)
>>>>
>>>> The thing is I don't know where I can insert the "exShutDown" function.
>>>>
>>>> Any ideas? max?
>>>>
>>>> in actionscript:
>>>>
>>>> import flash.external.Externalnterface();
>>>> ExternalInterface.addCallback("shutdown",exShutdown);
>>>> public function exShutDown():void {
>>>>            your-net-connection.close();
>>>> }
>>>>
>>>>
>>>> So I can use in the serving webpage:
>>>>
>>>> <script type="text/javascript>window.beforeonunload=function(e) {
>>>>       document.getElementById("whateveryoucallit").shutdown();
>>>> }
>>>> </script>
>>>>
>>>>
>>>> Thanks in advance.
>>>>
>>>>
>>>
>>
>>
>>
>



-- 
Lucas

Reply via email to