Example
This example retrieves a remote XML file using the XMLConnector by setting the
property to
. Drag an XMLConnector component into your library, and enter the
receive
following code on Frame 1 of the timeline:
import mx.data.components.XMLConnector;
var xmlListener:Object = new Object();
xmlListener.result = function(evt:Object) {
trace("results:");
trace(evt.target.results);
trace("");
};
xmlListener.status = function(evt:Object) {
trace("status::"+evt.code);
};
var myXMLConnector:XMLConnector = new XMLConnector();
myXMLConnector.addEventListener("result", xmlListener);
myXMLConnector.addEventListener("status", xmlListener);
myXMLConnector.direction = "receive";
myXMLConnector.URL = "http://www.flash-mx.com/mm/tips/tips.xml";
myXMLConnector.multipleSimultaneousAllowed = false;
myXMLConnector.suppressInvalidCalls = true;
myXMLConnector.trigger();
myXMLConnector.trigger();
myXMLConnector.trigger();
This code specifies the URL of the XML file and sets
. It triggers the XMLConnector instance three times, which causes the event listener's
false
method to display the error code
status
panel. The first attempt is successfully sent from Flash to the server. When the first trigger
successfully receives a result, the
displayed in the Output panel.
XMLConnector.URL
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
componentInstance.URL
CallAlreadyInProgress
event is broadcast and the XML packet you receive is
result
multipleSimultaneousAllowed
two times in the Output
XMLConnector.URL
direction
to
1503
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?