ʹÓÃXMLʵÏÖFlashÓë·þÎñÆ÷ͨÐÅ
ÕâÊÇһƪ½²½âÈçºÎʹÓÃXMLʵÏÖFlashÓëͨÐŵÄÈëÃż¶ÊµÀý½Ì³Ì¡£Í¨¹ý±¾ÀýµÄѧϰ£¬ÎÒÃǽ«Á˽âʹÓÃXML¿ª·¢Flash RIAsµÄ»ù±¾Á÷³Ì¡£
´ÓFlash Player 5¿ªÊ¼£¬¾Í¿ÉÒÔʹÓÃXML¶ÔÏóÀ´ÊµÏÖFlashÓëºǫ́ͨÐÅ¡£Flashä¯ÀÀÆ÷ÓëXMLÊý¾ÝÖ®¼äµÄÖ±½Ó½øÐÐÊý¾Ý½»»»£¬²¢ÇÒͬLoadVarsº¯ÊýÒ»Ñù£¬¶¼ÊÇÒÔ×Ö·û´®ÐÎʽ´«µÝµÄ¡£ºǫ́ÓïÑÔ×÷ΪXMLÊý¾ÝºÍÊý¾Ý¿âµÄÖн飬¸ºÔð½«Êý¾Ý¿âµÄÊý¾Ý¶¯Ì¬Éú³ÉXML£¬½«XML±ä¶¯µÄÊý¾Ý¸üлØÊý¾Ý¿â¡£ÈçÏÂͼËùʾ£º
XML¶ÔÏó¿É±ÈLoadVars¶ÔÏó¸ß¼¶¶àÁË£¬Ëü´¦ÀíµÄÊÇXMLÔªËØ£¬XMLÔªËر¾ÉíÓÐÒâÒå¶øÇÒ¸ñʽÁ¼ºÃ£¬ÀûÓÃÎÒÃǺ͵çÄÔʶ±ð£¬ ËüÔçÒѳÉΪÊý¾Ý½»»»¸ñʽµÄ±ê×¼¡£¶øLoadVarsÓÃÀ´´¦Àí±äÁ¿£¬LoadVarsÖеıäÁ¿ºÜÉÙÓÐʲôʵ¼ÊÒâÒ壬Èç¹ûÓÃÀ´¶ÁÈ¡Êý¾Ý¿âÖеÄÊý¾Ý£¬±äÁ¿»á ºÜ¶à¡£¶øXML¶ÔÏó¾Í¼òµ¥¶àÁË£¬ÓëXMLÏà¹ØµÄ¼¼ÊõºÜ¶à£¬±ÈÈçDOM¡¢SOM¡¢SMLT¡¢SAX2µÈ¡£¼´Ê¹Äã¶ÔÕâЩ¼¼Êõ²»Á˽⣬ÄãÒ²¿ÉÒÔÓúǫ́ÓïÑÔÊä³öÊý ¾ÝµÄ·½Ê½À´ÊµÏÖ¡£Èç¹ûÄã¶Ô¶øÇÒ·þÎñÆ÷¶Ë½Å±¾ÓïÑÔµÄÊä³öÊý¾ÝµÄ¸ñʽ²»Á˽⣬Çë¿´Ò»ÏÂhttp://www.riafan.com/article/flash/flash-exchange-date-with-server.html¡£
ʹÓÃXML¶ÔÏóÀ´ÊµÏÖFlashÓëºǫ́ͨÐÅ£¬Ö÷ÒªÊÇͨ¹ýXML¶ÔÏóµÄsendAndLoad·½·¨¡£¸Ã·½·¨ºÍLoadVarsµÄsendAndLoad·½·¨ ÀàËÆ£¬Ëü°ÑÖ¸¶¨µÄXML¶ÔÏó±àÂëΪXMLÎĵµ£¬Ê¹ÓÃPOST·½·¨½«Æä·¢Ë͵½Ö¸¶¨µÄURL£¬ÏÂÔØ·þÎñÆ÷µÄÏìÓ¦£¬²¢½«Æä¼ÓÔص½²ÎÊýÖÐÖ¸¶¨µÄ resultXMLobject ÖС£·þÎñÆ÷ÏìÓ¦¼ÓÔصķ½Ê½Óë XML.load·½·¨Ê¹Óõķ½Ê½Ïàͬ¡£
ÏÂÃæÊÇÒ»¸ö¼òµ¥µÄASP+XML+Flash²éѯʵÀý¡£XML.sendAndLoad·½·¨´«ÊäÒ»¸ö°üº¬Ñ§ÉúÐÕÃûµÄXML°ü£¬²¢Ê¹ÓÃonLoad·½·¨À´´¦ÀíÀ´×Ô·þÎñÆ÷µÄÏìÓ¦¡£
import mx.controls.Alert;
//н¨ÓÃÀ´ÏìÓ¦µÄXML¶ÔÏó
var response_xml= new XML();
//ÏìӦʱºöÂÔXML¿Õ°×
response_xml.ignoreWhite = true;
function showResult() {
//Çå³ýËùÓÐÏîÄ¿
student_dg.removeAll();
response_xml.onLoad = function() {
var nodes = this.firstChild.childNodes;
var len = nodes.length;
if (len < 1) {
Alert.show("ûÓÐËÑË÷µ½ÏàÓ¦µÄ¼Ç¼£¡", "ÌáʾÐÅÏ¢");
} else {
//½«XML¶ÔÏó½âÎö³ÉÏîÄ¿¶ÔÏó
for (var i=0; i < len; i++) {
student_dg.addItem({ѧºÅ:nodes[i].attributes.id,
ÐÕÃû:nodes[i].attributes.name,
°à¼¶:nodes[i].attributes.cname});
}
}
}
}
//н¨ÓÃÀ´·¢ËÍÇëÇóµÄXML¶ÔÏó
var request_xml = new XML();
//´´½¨Ò»¸öÐÂµÄ ÔªËØ
Ïà¹ØÎĵµ£º
Òë×ÔVault API°ïÖúÎĵµÖÐһƪ Doug RedmondдµÄknowledgebase article. Doug's ²©¿ÍÊÇ It's All Just Ones and Zeros
ÄãÒ²Ðí²»ÖªµÀËùÓÐVault API À඼¿ÉÒÔ XML ÐòÁл¯ - ÕâÒâζןÜÈÝÒ×°ÑAPI¶ÔÏóת»»Îª XML Îı¾£¬·´Ö®ÒàÈ»¡£
ºÜ¶àÖÖÇé¿öÏ¿ÉÒÔʹÓô˹¦ÄÜ£¬ÀýÈ磺
Ëü¿ÉÒÔ°ïÖúÄúµ÷ÊÔ´úÂë¡£Èç¹ûÄú¾ßÓдóÁ¿Êý¾ÝµÄ¶ÔÏ ......
µÚÒ»£¬Ìí¼Ó¿Ø¼þ¡£
¹¤¾ßÏä Ìí¼Ó—COM×é¼þ—Ñ¡ÔñShockwave Flash Object£¬µã»÷È·¶¨¡£Ö®ºó¸ù¾ÝÐèÒª¶Ô¸ÃdllÎļþ½øÐÐ×¢²á¡£
×¢²á·½Ê½Îªregsvr32 C:\Windows\System32\Macromed\Flash\Flash10a.ocx [²é¿´Õâ¸öĿ¼£¬°æ±¾²»Í¬¿ÉÄÜ´ËÎļþÃû²»Í¬]
µÚ¶þ£¬ÍϷſؼþÖÁ´°Ìå¡£
......
Ò»¡¢±¾ÕÂÖ÷Òª½éÉÜ.NET XMLÐòÁл¯£¬¹¹½¨XMLÐòÁл¯µÄ¿ò¼ÜÀ࣬Ö÷Òª·ÅÔÚÄãµÄ¿ò¼ÜÏîÄ¿ÀïÃ棬ÀàÃû×ÖÃüÃûΪSerialiser£¬ÎҵĿò¼ÜÏîÄ¿Ãû³ÆÊÇMingXu.FrameWork£¬ÎÒ½«Serialiser·Åµ½ËüÏÂÃ棬MingXu.FrameWorkÀàÐÍΪClass Library
¶þ¡¢ÐòÁл¯ÀàÓõ½ÁË2¸ödll£¬·Ö±ðΪ£º
System.Xml.Serialization£ºX ......
FlashÖеÄXML¶ÔÏóÒ²Óз½·¨¿ÉÒÔ½«XMLÊý¾ÝÏò·þÎñÆ÷·¢ËÍ¡£¼´sendºÍsendAndLoad¡£send·½·¨Ïòij¸ö URL ´«µÝ XML ¶ÔÏ󣬷µ»ØµÄÐÅÏ¢¶¼±»·¢Ë͵½ÁíÍâÒ»¸öä¯ÀÀÆ÷´°¿Ú£»sendAndLoad ·½·¨Ïòij¸ö URL ·¢ËÍÒ»¸ö XML ¶ÔÏó¡£·µ»ØµÄÐÅÏ¢¶¼·ÅÔÚÒ»¸öXML¶ÔÏóÖС£
ÔÚijÖ̶ֳÈÉÏ£¬ XMLµÄsend·½·¨ºÍsendAndLoad·½·¨ÀàËÆÓÚloadVars¶ÔÏóµÄsend·½·¨ºÍ ......
Class.xml
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="class.css"?>
<bookdetail>
<book class="A">
<author>²ÜÑ©ÇÛ</author>
<title>ºìÂ¥ÃÎ</title>
<price>60.00</price>
</book>
<book class="A"& ......