# XML an AS3 'addItem(s)"

**URL:** https://forum.kirupa.com/t/xml-an-as3-additem-s/272986
**Category:** flash
**Created:** [October 9, 2008, 10:45pm UTC](https://forum.kirupa.com/t/xml-an-as3-additem-s/272986 "2008-10-09T22:45:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bluecube](https://avatars.discourse-cdn.com/v4/letter/b/c57346/32.png) [@bluecube](https://forum.kirupa.com/u/bluecube)
#### Post date: [October 9, 2008, 10:45pm UTC](https://forum.kirupa.com/t/xml-an-as3-additem-s/272986/1 "2008-10-09T22:45:19Z")

</div>

I was following a tutorial on the Adobe developer network that is a video playlist being populated by an XML file. I’m new to using XML and I’m kind of stumped and I was hoping someone would help me. I would like to add another element or attribute to the XML file but how do I call it in the Action Script?

AS3\>\>\>There is a class constructor and a method which loads the XML data which in turn loads another method (‘initMediaPlayer’) below which is what is going through the XML nodes :

```auto

public function initMediaPlayer(event:Event):void {
    var myXML:XML = new XML(xmlLoader.data);
    var item:XML;
    for each (item in myXML.vid) {
// populate playlist.
// Get thumbnail value and assign to cellrenderer.
    var thumbnail:String;
    if (item.hasOwnProperty("@thumbnail")>0) {
        thumbnail = item.@thumbnail;
        }
// Send data to tileList.
    tileList.addItem({label:item.attribute("description").toXMLString(), 
        data:item.attribute("src").toXMLString(),
        source:thumbnail});
    }
        

```

XML file looks like this:

```auto

<?xml version="1.0" encoding="UTF-8"?>
<playlist id="My Video Player" >
    
    <vid description="Lorem ipsum dolor sit amet" 
        src="movies/myMovie.flv" 
        thumbnail="thumbnails/smallPic.jpg" />
    
</playlist>

```

So now I would like to add another element

```auto

<?xml version="1.0" encoding="UTF-8"?>
<playlist id="My Video Player" >
    
    <vid description="Lorem ipsum dolor sit amet" 
        **details="consectetuer adipiscing elit. Maecenas quis nunc"**
        src="movies/myMovie.flv" 
        thumbnail="thumbnails/smallPic.jpg" />
        
</playlist>

```

How do I modify the method to get another element …or does anyone know of a tutorial out there. Thanks.
