Reputation: 4055
I am trying to get the value of an attribute full
where another attribute name
is equal to something e.target.name
.
So in this case I am trying to get the value of "full"
var full_url = myXML.item.@full.(@name=="e.target.name");
This is my XML:
<item name="Toy Box" thumb="resize/thumb_image2.png" full="full_images/image2.png" />
<item name="Toy Train" thumb="resize/thumb_image3.png" full="full_images/image3.png" / >
<item name="Toy Truck" thumb="resize/thumb_image4.png" full="full_images/image4.png" />
So my as above should return one of the But when I trace full_url I get nothing and no errors.
Upvotes: 4
Views: 10375
Reputation: 22604
You have two errors in your e4x statement: There should not be quotes around e.target.name
, and you have to select the item before you can call the value of @full
.
This should work:
var full_url:String = myXML.item.(@name==e.target.name).@full;
(that's assuming myXML
also has a root element somewhere).
Upvotes: 4