# How do I look for the name of a node that must stored in a variable?

**URL:** https://forum.kirupa.com/t/how-do-i-look-for-the-name-of-a-node-that-must-stored-in-a-variable/265266
**Category:** flash
**Created:** [July 7, 2008, 7:29am UTC](https://forum.kirupa.com/t/how-do-i-look-for-the-name-of-a-node-that-must-stored-in-a-variable/265266 "2008-07-07T07:29:35Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![mpc2001](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@mpc2001](https://forum.kirupa.com/u/mpc2001)
#### Post date: [July 7, 2008, 7:29am UTC](https://forum.kirupa.com/t/how-do-i-look-for-the-name-of-a-node-that-must-stored-in-a-variable/265266/1 "2008-07-07T07:29:35Z")

</div>

Hi. I am trying to write a simple flash app looks for a for certain node in an xml file. The particular node is stored in a variable so that the node can be changed dynamically.How would I write this? so far I have the following code but it doesnt seem to be working. I get this error  
1151: A conflict exists with definition diffLevel in namespace internal.

How would I write this correctly?

[FONT=Fixedsys]var diffLevel:String = new String;  
var diffLevel= “trdrugbreaks”;[/FONT]  
[FONT=Fixedsys][/FONT]

[FONT=Fixedsys]var xmlURL:URLRequest = new URLRequest(“testObject.xml”);  
var xmlLoader:URLLoader = new URLLoader(xmlURL);  
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);[/FONT]  
[FONT=Fixedsys]function xmlLoaded(event:Event) {  
var dataXML = XML(event.target.data);

trace(dataXML.productCodes.diffLevel);

}[/FONT]  
[FONT=Fixedsys][/FONT]

---

<div class="post-metadata">

### Author: ![pensamente](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pensamente/32/1208_2.png) [@pensamente](https://forum.kirupa.com/u/pensamente)
#### Post date: [July 7, 2008, 9:01am UTC](https://forum.kirupa.com/t/how-do-i-look-for-the-name-of-a-node-that-must-stored-in-a-variable/265266/2 "2008-07-07T09:01:21Z")

</div>

maybe just typed var 2 times… don’t know if theres something more, but try it this way:

var diffLevel:String = new String;  
diffLevel= “trdrugbreaks”;

once you create a variable, you don’t “var” again to change it’s value, doing that you are telling flash to create another… in your case with the same name - diffLevel.

hope this helps

---

<div class="post-metadata">

### Author: ![mpc2001](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@mpc2001](https://forum.kirupa.com/u/mpc2001)
#### Post date: [July 7, 2008, 4:34pm UTC](https://forum.kirupa.com/t/how-do-i-look-for-the-name-of-a-node-that-must-stored-in-a-variable/265266/3 "2008-07-07T16:34:44Z")

</div>

yeah its still not working.  
by typing this: trace(dataXML.productCodes.diffLevel);  
I want it to actually trace this  
trace(dataXML.productCodes.trdrugbreaks);  
It can’t be hardcoded because the node is going to be different every tiem the its activated.

---

<div class="post-metadata">

### Author: ![mpc2001](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@mpc2001](https://forum.kirupa.com/u/mpc2001)
#### Post date: [July 7, 2008, 4:47pm UTC](https://forum.kirupa.com/t/how-do-i-look-for-the-name-of-a-node-that-must-stored-in-a-variable/265266/4 "2008-07-07T16:47:15Z")

</div>

i did take the extra var off. but it didnt fix it.

---

<div class="post-metadata">

### Author: ![devonair](https://avatars.discourse-cdn.com/v4/letter/d/3be4f8/32.png) [@devonair](https://forum.kirupa.com/u/devonair)
#### Post date: [July 7, 2008, 5:13pm UTC](https://forum.kirupa.com/t/how-do-i-look-for-the-name-of-a-node-that-must-stored-in-a-variable/265266/5 "2008-07-07T17:13:00Z")

</div>

try:  
[AS]trace(dataXML.productCodes.child(diffLevel));[/AS]

---

<div class="post-metadata">

### Author: ![mpc2001](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@mpc2001](https://forum.kirupa.com/u/mpc2001)
#### Post date: [July 7, 2008, 7:37pm UTC](https://forum.kirupa.com/t/how-do-i-look-for-the-name-of-a-node-that-must-stored-in-a-variable/265266/6 "2008-07-07T19:37:11Z")

</div>

Thanks that worked perfectly. I need to get up on my action script 3.

---

<div class="post-metadata">

### Author: ![devonair](https://avatars.discourse-cdn.com/v4/letter/d/3be4f8/32.png) [@devonair](https://forum.kirupa.com/u/devonair)
#### Post date: [July 7, 2008, 10:52pm UTC](https://forum.kirupa.com/t/how-do-i-look-for-the-name-of-a-node-that-must-stored-in-a-variable/265266/7 "2008-07-07T22:52:57Z")

</div>

groovy… glad that helped out…
