Best way to dynamically load an xml configuration file into a Flex4/Flash movie at runtime?

家住魔仙堡 提交于 2019-12-13 17:07:21

问题


I've got a rather simple question about loading in an xml file at runtime in a SWF.

I've found a couple different methods to load in the xml.

  • myXml.load("file.xml");
  • HTTPService object
  • URLStream object

What is better way to load an xml file that always has the same name and is located in the same folder as the SWF on the web server?


回答1:


I would use URLLoader - I think that's the most lightweight one.

  • The complexity of URLStream is unnecessary as far as a configuration file is concerned.
  • HTTPService again is heavy for this simple task (and Flex only). Of course, it allows you to get away with minimum code, but I use it only for something that needs to be updated repeatedly (binding the lastResult to a live DataGrid etc).
  • myXml.load() - this is not AS3, is it?


来源:https://stackoverflow.com/questions/2147418/best-way-to-dynamically-load-an-xml-configuration-file-into-a-flex4-flash-movie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!