简体   繁体   中英

Flash and XML beginner issue

I´m new to XML and I´ve tried a couple of tutorials but nothing seems to work.

ERROR: URLLoader not defined.

  1. Whats wrong with my structure? How should it look like?
  2. How can i save a highscore in XML and read it out later?

     //XML public var oLoader= new URLLoader(); public var oUrl:URLRequest; public function Main() { oLoader.addEventListener(Event.COMPLETE, _oListener); LoadData("LoadTest.xml", LoadDataComplete); } public function _oListener(_tUrl:String, _oListener:Function) { oUrl= new URLRequest(_tUrl); oLoader.load(oUrl); } public function LoadDataComplete(_oEvent:Event) { var xmlFile:XML = new XML(_oEvent.currentTarget.data); //XML_txt.text = xmlFile; trace(xmlFile.GroupNode.TextNode[0]); trace(xmlFile.AttributeNode.toXMLString()); trace(xmlFile.AttributeNode.@Id); } 

you are missing import statement import flash.net.*;

This will include the required URLLoader and URLRequest classes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM