Paul Mignard
Paul Mignard

Reputation: 5934

In Flash, how would I run an e4x statement when that statement is stored in a String?

So I have something like this:

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

What mystery function do I have to use so that I can execute xmlStatement and get thisValue from that xmlObject? Like....

var attribute:String = mysteryFunction(xmlStatement);

P.S. I know eval() works for actionscript2, I need the as3 solution. :)

Upvotes: 3

Views: 330

Answers (2)

Sev
Sev

Reputation:

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

Upvotes: 0

Christophe Herreman
Christophe Herreman

Reputation: 16085

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

Upvotes: 5

Related Questions