[Laszlo-dev] How can I use fscommand in Laszlo?

Asger Alstrup aalstrup at laerdal.dk
Mon Nov 7 06:42:12 PST 2005


Hi,

We're working on a mind-mapping application in Laszlo, where the users can 
create mindmaps`on the web. As part of this, we need to communicate between 
the browser and flash. We currently do this using the Laszlo API for this, 
which translated into a "getUrl:javascript" call. This works well, and we 
are happy about it.

At the same time, we use the HTML browser feature "onbeforeunload" which 
allows you to prevent the user from navigating away from a web-page by 
accident. This is great for making sure that users do not loose their work: 
Before the browser "unloads" a page, it asks the user for confirmation.

The problem is that the Laszlo browser API (the getUrl call) is considered 
an "unload" event by the browser, so each time we communicate with the 
browser from Laszlo, the warning pops up. In browser-side javascript, it is 
possible to remove the unbeforeunload handler, to prevent this from 
happying, but we need a way to communicate from flash to the browser, that 
does not interfere with this flag.

Now, flash 7 provides the fscommand which also allows you to communicate 
with the browser. This method is very much crippled compared to the geturl- 
javascript solution, but nevertheless we would very much like to use this 
in this particular case, because it would allow us to disable the 
onbeforeunload handler, and then use the geturl method to do the 
browser-communication, which could then afterwards re-enable the 
onbeforeunload handler in the browser.

So the question is simply:

How can I use fscommand from Laszlo?

In the forums, there have been some examples posted, but none of these work 
with Laszlo 3.0.2 - either they do not do anything, or they crash the 
browser in an infinite loop. We are ready to do some lifting to get this to 
work, since it is a crucial feature in our application, but how can it be done?

Alternatively, Flash 8 provides much more extensive browser integration 
features (http://www.communitymx.com/content/article.cfm?cid=0922A). Are 
there plans to support this in Laszlo as an alternative to the getUrl method?

Thanks in advance,
Asger Ottar Alstrup
Laerdal Sophus


More information about the Laszlo-dev mailing list