# Convert chlid nodes to var

**URL:** <https://forum.kirupa.com/t/convert-chlid-nodes-to-var/315645>\
**Category:** flash\
**Created:** [October 31, 2010, 7:29pm UTC](https://forum.kirupa.com/t/convert-chlid-nodes-to-var/315645 "2010-10-31T19:29:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebswed](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@sebswed](https://forum.kirupa.com/u/sebswed)\
**Post date:** [October 31, 2010, 7:29pm UTC](https://forum.kirupa.com/t/convert-chlid-nodes-to-var/315645/1 "2010-10-31T19:29:42Z")

</div>

Hi, I tried the last 3 hours to convert child nodes to variables.

I followed the tutorial on [http://www.kirupa.com/developer/flashcs3/using\_xml\_as3\_pg1.htm](http://www.kirupa.com/forum/../developer/flashcs3/using_xml_as3_pg1.htm)

I use the following (working) code:

```auto
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("language.xml"));
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
ParseLanguages(xmlData);
}
 
function ParseLanguages(LanguagesInput:XML):void {
trace("XML Output");
trace("------------------------");
var languageList:XMLList = LanguagesInput.Language.(Country == "CtryNo=752&LangNo=46");
trace(languageList);
}

```

My output is:

```auto
<Language lang="Sweden">
  <Country>CtryNo=752&amp;LangNo=46</Country>
  <Search>Sök</Search>
  <Link>Länk till produktsida</Link>
  <CompBat>Kompatibelt med följande batterier</CompBat>
  <CompDev>Kompatibelt med följande apparater</CompDev>
</Language>

```

Now I try to assign variables to each child (Country, Search, Link, etc). But I don’t seem to succeed with that.

I tried different approaches like:

[LIST]  
[_]var test = languageList.Country  
[_]var test = e.item.Country  
[/LIST]  
In my xml file I have 8 languages. I’m grateful for any help I can get 🙂
