User Guide

194 Chapter 10: Events and Messages
on sendXML
Usage
-- Lingo syntax
on sendXML "sendxmlstring", "window", "postdata"
statement(s)
end
// JavaScript syntax
function sendXML(sendxmlstring, window, postdata) {
statement(s);
}
Description
Event handler; functions much like the getURL scripting method, which is also available using the
Macromedia Flash Asset Xtra extension. The
on sendXML handler is called in Lingo when the
XMLobject.send ActionScript method is executed in a Flash sprite or Flash XML object.
In ActionScript, the
XMLobject.send method passes two parameters in addition to the XML
data in the XML object. These parameters are as follows:
url the URL to send the XML data to. Usually this is the URL of a server script that is
waiting to process the XML data.
window the browser window in which to display the server’s response data.
The ActionScript
XMLobject.send method can be called in Director either by a Flash sprite or by
a global Flash XML object created in Lingo. When this happens, the Lingo
on sendXML handler
is called, and the same parameters are passed to the handler.
The following Lingo illustrates how the parameters are received by the
on sendXML handler:
on sendXML me, theURL, targetWindow, XMLdata
These parameters correlate with the XMLobject.send parameters as follows:
theURL the URL to send the XML data to.
targetWindow the browser window in which to display the server’s response.
XMLdata the XML data in the Flash XML object.
By creating an
on sendXML handler in your Director movie, you enable it to process
XMLobject.send events generated in a Flash sprite or a global Flash object.
Flash sprites can also load external XML data or parse internal XML data. The Flash Asset
Xtra extension handles these functions in the same way as Flash 5 or Flash MX content in
your browser.
Example
This Lingo command gets the XMLobject.send method information from a Flash sprite and
then directs the browser to the URL and transmits the XML data to the URL:
-- Lingo syntax
on sendXML me, theURL, targetWindow, xmlData
gotoNetPage(theURL, targetWindow)
postNetText(theURL, xmlData)
end