03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The following example creates an array named headers that contains two alternating HTTP<br />

headers <strong>and</strong> their associated values. The array is passed as a parameter to the<br />

addRequestHeader() method.<br />

var headers:Array = new Array("Content-Type", "text/plain", "X-<br />

ClientAppVersion", "<strong>2.0</strong>");<br />

my_xml.addRequestHeader(headers);<br />

See also<br />

addRequestHeader (LoadVars.addRequestHeader method)<br />

contentType (XML.contentType property)<br />

public contentType : String<br />

The MIME content type that is sent to the server when you call the XML.send() or<br />

XML.sendAndLoad() method. The default is application/x-www-form-urlencoded, which<br />

is the st<strong>and</strong>ard MIME content type used for most HTML forms.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Example<br />

The following example creates a new XML document <strong>and</strong> checks its default content type:<br />

// create a new XML document<br />

var doc:XML = new XML();<br />

// trace the default content type<br />

trace(doc.contentType); // output: application/x-www-form-urlencoded<br />

The following example defines an XML packet, <strong>and</strong> sets the content type for the XML object.<br />

The data is then sent to a server <strong>and</strong> shows a result in a browser window.<br />

var my_xml:XML = new XML("Ernie13045");<br />

my_xml.contentType = "text/xml";<br />

my_xml.send("http://www.flash-mx.com/mm/highscore.cfm", "_blank");<br />

Press F12 to test this example in a browser.<br />

See also<br />

send (XML.send method), sendAndLoad (XML.sendAndLoad method)<br />

XML 1311

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!