In Flash, how can I run an e4x statement when this statement is stored in String?

So, I have something like this:

var xmlStatement:String = "xmlObject.node[3].@thisValue";

What mystery function do I need to use so that I can execute xmlStatement and get thisValue from this xmlObject? How....

var attribute:String = mysteryFunction(xmlStatement);

PS I know that eval () works for actionscript2, I need an as3 solution. :)

+3
source share
2 answers

Unfortunately, this is not possible in ActionScript 3. This may be a solution: http://blog.betabong.com/2008/09/23/e4x-string-parser/

+5
source

For your example, this would be: var attribute: String = String (E4X.evaluate (XMLList (xmlobject), 'node [3]. @ThisValue'));

0
source

Source: https://habr.com/ru/post/1697783/


All Articles