XML
721
Example
The following example creates a new XML document and checks its default content type:
// create a new XML document
var doc:XML = new XML();
// trace the default content type
trace(doc.contentType); // output: application/x-www-form-urlencoded
The following example defines an XML packet, and sets the content type for the XML object.
The data is then sent to a server and shows a result in a browser window.
var my_xml:XML = new XML("<highscore><name>Ernie</name><score>13045</score>
</highscore>");
my_xml.contentType = "text/xml";
my_xml.send("http://www.flash-mx.com/mm/highscore.cfm", "_blank");
Press F12 to test this example in a browser.
See also
send (XML.send method)
,
sendAndLoad (XML.sendAndLoad method)
createElement (XML.createElement method)
public createElement(name:
String
) : XMLNode
Creates a new XML element with the name specified in the parameter. The new element
initially has no parent, no children, and no siblings. The method returns a reference to the
newly created XML object that represents the element. This method and the
XML.createTextNode()
method are the constructor methods for creating nodes for an XML
object.
Availability:
ActionScript 1.0; Flash Lite 2.0
Parameters
name
:
String
- The tag name of the XML element being created.
Returns
XMLNode
- An XMLNode object; an XML element.
Summary of Contents for FLASHLITE2 ACTIONSCRIPT-LANGUAGE
Page 1: ...Flash Lite 2 x ActionScript Language Reference...
Page 22: ...22 Contents...
Page 244: ...244 ActionScript language elements...
Page 760: ...760 ActionScript classes...