# Cannot set E4X attribute to variable - Going INSANE!

**URL:** <https://forum.kirupa.com/t/cannot-set-e4x-attribute-to-variable-going-insane/277727>\
**Category:** flash\
**Created:** [December 16, 2008, 3:07pm UTC](https://forum.kirupa.com/t/cannot-set-e4x-attribute-to-variable-going-insane/277727 "2008-12-16T15:07:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![duncanhall](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@duncanhall](https://forum.kirupa.com/u/duncanhall)\
**Post date:** [December 16, 2008, 3:07pm UTC](https://forum.kirupa.com/t/cannot-set-e4x-attribute-to-variable-going-insane/277727/1 "2008-12-16T15:07:45Z")

</div>

I’ve spent several hours on this already and I can’t remember the last time I got so frustrated by anything Actionscript related. If anyone can help, and thus prevent me launching my monitor through the office window, it would be hugely appreciated.

I have an XML file loaded at run time. Among others, it contains several nodes which contain a name attribute and a value attribute. I want to be able to select name by value and vice versa.

If I try and trace out a name by selecting its value, I get exactly what I expected:

[AS]  
trace( "NAME: " + SiteModel.instance.constants.(@value==section).@name );  
[/AS]

But, and this is what I’ve been screaming at for most of the morning, if I try and assign that name to a variable, and trace the variable, I get epic fail:

[AS]  
var n:String = SiteModel.instance.constants.(@value==section).@name;  
trace( "NAME: " + n );  
[/AS]

Trying to trace that variable results in a TypeError:

```auto

TypeError: Error #1010: A term is undefined and has no properties.

```

This is stupifyingly ridiculous in my opinion, so If someone has any ideas they are more than welcome.
