如何使用 AS3 和 E4X 获得 3 个节点?
我正在 Main.as 中编写一个类,它生成 urlRequest 并返回结果。我需要 3 个节点,minTemp、maxTemp 和 Icon。我正在向一个城市发出请求,因此这些节点应该只出现一次。我将如何构建 AS3 来获取这些节点及其值?
public class Main extends MovieClip {
public function Main() {
var urlRequest:URLRequest=new URLRequest("http://myurl");
var urlLoader:URLLoader=new URLLoader();
var result:XmlDocument=new XMLDocument();
urlLoader.addEventListener(Event.COMPLETE, parseXML);
urlLoader.load(urlRequest);
result.ignorWhite=true;
result.parseXML(getXMLString());
}
}
我收到错误 1046 XmlDocument 类型未找到、1120 访问未定义的属性 parseXML 以及 1180 调用可能未定义的方法 getXMLString。我该如何清除这些呢?
I am writing a class in Main.as that makes a urlRequest and returns the result. There are 3 nodes I need, minTemp, maxTemp and Icon. I'm making the request for one city so there should be just one occurrence of these nodes. How would I structure the AS3 to grab these nodes and their values?
public class Main extends MovieClip {
public function Main() {
var urlRequest:URLRequest=new URLRequest("http://myurl");
var urlLoader:URLLoader=new URLLoader();
var result:XmlDocument=new XMLDocument();
urlLoader.addEventListener(Event.COMPLETE, parseXML);
urlLoader.load(urlRequest);
result.ignorWhite=true;
result.parseXML(getXMLString());
}
}
I'm getting errors 1046 XmlDocument type was not found, 1120 access of undefined property parseXML, and 1180 call to possibly undefined method getXMLString. How would I clear those up as well?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有定义函数 parseXMl 并且结果也没有创建,这种方式应该可以工作:
You did not define the function parseXMl and result is not created either, this way should work: