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, Ro开发者_运维知识库ss
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.
You can also use the child notation as well.
精彩评论