Ross
Ross

Reputation: 14425

EX4 ActionScript and a minus symbol

I have a XML node with a - (minus) character in it. How can I access this in ActionScript E4X symtax without the compiler recognising the character as a minus operator?

E.g.

XML

<page>
     <about-page>yo</about-page>
</page>

ActionScript

this.contentXML..page.about-page.text()

Thanks, Ross

Upvotes: 0

Views: 453

Answers (2)

simonrichardson
simonrichardson

Reputation: 1049

You can also use the child notation as well.

Upvotes: 2

Ivo Wetzel
Ivo Wetzel

Reputation: 46756

You should be able to use the square bracket notation for accessing the property:

this.contentXML.page['about-page'].text()

Both the dot and square bracket notation do essentially the same thing, that is looking up a property. The only difference here is that the dot notation is limited by the syntax of the language.

Upvotes: 3

Related Questions