MACROMEDIA FLASH MEDIA SERVER 2-SERVER MANAGEMENT ACTIONSCRIPT LANGUAGE Manuale Utente Pagina 134

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 155
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 133
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
131
my_xml.onLoad = function(success) {
trace("success: "+success);
trace("loaded:"+my_xml.loaded);
trace("status:"+my_xml.status);
};
my_xml.load("http://www.flash-mx.com/mm/problems/products.xml");
Information is written to the log file when the onLoad() handler is invoked. If the call completes successfully, the
loaded status true is written to the log file, as shown in the following example:
success: true
loaded:true
status:0
XML.localName
my_xml.localName
Read-only; the local name portion of the XML node's name. This is the element name without the namespace prefix.
For example, the node
<contact:mailbox/>[email protected]</contact:mailbox> has the local name
mailbox and the prefix contact, which comprise the full element name contact.mailbox.
You can access the namespace prefix by using the
XML.prefix property of the XML node object. The XML.nodeName
property returns the full name, including the prefix and the local name.
Availability
Flash Media Server 2
Example
This example uses a SWF file and an XML file located in the same directory. The XML file, named SoapSample.xml,
contains the following code:
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope">
<soap:Body xmlns:w="http://www.example.com/weather">
<w:GetTemperature>
<w:City>San Francisco</w:City>
</w:GetTemperature>
</soap:Body>
</soap:Envelope>
The source for the SWF file contains the following script (note the comments for the Output strings):
var xmlDoc = new XML()
xmlDoc.ignoreWhite = true;
xmlDoc.load("http://www.example.com/SoapSample.xml")
xmlDoc.onLoad = function(success) {
var tempNode = xmlDoc.childNodes[0].childNodes[0].childNodes[0];
trace("w:GetTemperature localname: " + tempNode.localName);
// Output: ... GetTemperature
var soapEnvNode = xmlDoc.childNodes[0];
trace("soap:Envelope localname: " + soapEnvNode.localName);
// Output: ... Envelope
};
See also
XML.nodeName, XML.prefix
Vedere la pagina 133
1 2 ... 129 130 131 132 133 134 135 136 137 138 139 ... 154 155

Commenti su questo manuale

Nessun commento