// Function that runs when the user clicks a "Test XML" button after
// entering text in two text boxes. Handles a return message sent by
// the server:
function testDocument(){
// Create the XML document.
var xmlDocument:XML = new XML();
var firstElement:XMLNode = xmlDocument.createElement("test");
firstElement.attributes.message = input1_txt.text;
var secondElement:XMLNode = xmlDocument.createElement("insidetest");
secondElement.attributes.message = input2_txt.text;
firstElement.appendChild(secondElement);
xmlDocument.appendChild(firstElement);
// Call the service function and pass it the XML document
trace(xmlDocument);
}
// Result Handler to handle the results returned by the Remoting call
function testDocument_Result(result){
// Result is an XML object
// For this example, get an attribute from the first node
output_txt.text = result.firstchild.attributes["message"] +
result.firstchild.firstchild.attributes["message"];
}
Note: Because the Flash XML object is a standard Flash object and not part of Flash Remoting, this
document does not cover the details of using XML objects in Flash. For more information on using
the Flash XML objects, see Flash Help.
86
Chapter 4: Using Flash Remoting Data in ActionScript
Need help?
Do you have a question about the FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 and is the answer not in the manual?