
WEBXTRA HELP: EVENTS
A new addition to WebXtra since version 4 is the concept of events. The Xtra sprite
will generate scripting events that are sent directly to scripts attached to it, and pass
the normal message chain in Director, reaching frame and movie scripts if they are
not handled at the sprite level. This avoids the need to poll the browser for
information continuously, as your scripts will be informed of any changes
necessary. All events pass the "spriteRef" as the first parameter, and this value can
be used to extract information about the sprite that generated the event directly.
Some events accept return values to indicate how the browser should react to a
specific situation. Using events it is possible for example to block the creation of
popup windows or authorize navigation to a specific link or URL, before it takes
place. If you need more information please study the "WebBrowser_Behavior"
script, attached to the "Complete Browser" example that ships with the Xtra. This is
a good example of a simple behavior showing how your scripts can intercept events
and act on them.
It is not necessary to implement a script to handle all events if you are not planning
to use them: the Xtra will assume default values if an event is not handled. You can
implement handlers only for the events that are appropriate for your movie, or you
can use the pre-made behaviors available at our site as a starting point for your own
scripts. Below are the events generated by WebXtra 4:
displayScrollBars(spriteRef) - Generated by the sprite when a browser window is
create or refreshed, to control the display of outer scroll bars in the main window
frame. Scripts can return FALSE to prevent scroll bars from appearing. The default
behavior of the browser is to automatically create scroll bars.
Lingo example:
on displayScrollBars spriteRef
return false
end
JavaScript syntax example:
function displayScrollBars(spriteRef){
return false
}
Online Help
28
Komentáře k této Příručce