在Flash中,当该语句存储在String中时,如何运行e4x语句?
时间:2020-03-06 14:59:37 来源:igfitidea点击:
所以我有这样的事情:
var xmlStatement:String = "xmlObject.node[3].@thisValue";
我必须使用什么神秘函数才能执行xmlStatement并从该xmlObject获取thisValue?喜欢....
var attribute:String = mysteryFunction(xmlStatement);
P.S.我知道eval()适用于actionscript2,我需要as3解决方案。 :)
解决方案
不幸的是,这在ActionScript 3中是不可能的。但是,这可能是一种解决方案:http://blog.betabong.com/2008/09/23/e4x-string-parser/
以示例为例:
var attribute:String = String(E4X.evaluate(XMLList(xmlobject),'node [3]。@ thisValue'));