XML reading is working. How do I use a text attribute operation in code?


  • Posts: 91
I was able to get XML reading working. I used this Kirupa tutorial:

I'd like to use an attribute for the bookInput operation so users don't have to dig into the code, they can just set the fields to return. However, every time I pass it, it reads it as a string. Using {} and [] doesn't work. Any other ideas?


  • *
  • Posts: 17529
Put an @ before the attribute's name (where attribute means the XML attribute).

For example

var n:Number = xml.@someValue;


  • Posts: 91
Actually, I meant a behavior attribute not an XML attribute. I should have been more specific.

I solved the problem by using child() methods with behavior attributes specifying the element names.

So this:

can be replaced by this:

I'll try to release a new XML behavior soon that uses attributes. However, I doubt many people will be interest in using it until the security sandbox issue is dealt with since it breaks when loaded to web portals. At least, I think it's the SS that is breaking it.