# XML issue!

**URL:** <https://forum.kirupa.com/t/xml-issue/275366>\
**Category:** Uncategorized\
**Created:** [November 12, 2008, 11:16pm UTC](https://forum.kirupa.com/t/xml-issue/275366 "2008-11-12T23:16:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![willythewho](https://avatars.discourse-cdn.com/v4/letter/w/48db29/32.png) [@willythewho](https://forum.kirupa.com/u/willythewho)\
**Post date:** [November 12, 2008, 11:16pm UTC](https://forum.kirupa.com/t/xml-issue/275366/1 "2008-11-12T23:16:09Z")

</div>

I need help ! (newbie in AS2)

I want to have two XML  
One button (that onRealese it goes to second frame or previous)  
2 frames

1st frame AS

```auto
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function() {
 //parse XML data:
 var imagesNode = myXML.firstChild;
 var totalImages = myXML.firstChild.childNodes.length;
 for (i=0; i<totalImages; i++) {
  var imgNode = imagesNode.childNodes*.childNodes[0].firstChild.nodeValue;
  var textNode = imagesNode.childNodes*.childNodes[1].firstChild.nodeValue;
  var linkNode = imagesNode.childNodes*.childNodes[0].attributes.link;
  trace("test: "+imgNode);
  trace("test: "+textNode);
  trace("link: "+linkNode);
  //attatch template clips to hold images & text
  var newClip = _root.attachMovie("templateClip", "templateClip"+i, _root.getNextHighestDepth());
  //Define the grid columns (in number of cells);
  var columns:Number = 4;
  //Define the item hSpacing;
  var hSpacing:Number = 10;
  //Define the item hSpacing;
  var vSpacing:Number = 10;
  //position clip
  newClip._x = 50;
  newClip._y = 10;
  newClip._x += ((i%columns))*(newClip._width+hSpacing);
  newClip._y += Math.floor(i/columns)*(newClip._height+vSpacing);
  //populate template clip
  newClip.textField_txt.text = textNode;
  newClip.imageHolder.loadMovie(imgNode);
  newClip.btn.onPress = function() {
   getURL(linkNode, "_blank");
  };
 }
};
myXML.load("data.xml");
stop();

```

2nd frame

```auto
var myXML2:XML = new XML();
myXML2.ignoreWhite = true;
myXML2.onLoad = function() {
 //parse XML data:
 var imagesNode = myXML2.firstChild;
 var totalImages = myXML2.firstChild.childNodes.length;
 for (i=0; i<totalImages; i++) {
  var imgNode = imagesNode.childNodes*.childNodes[0].firstChild.nodeValue;
  var textNode = imagesNode.childNodes*.childNodes[1].firstChild.nodeValue;
  var linkNode = imagesNode.childNodes*.childNodes[0].attributes.link;
  trace("test: "+imgNode);
  trace("test: "+textNode);
  trace("link: "+linkNode);
  //attatch template clips to hold images & text
  var newClip = _root.attachMovie("templateClip", "templateClip"+i, _root.getNextHighestDepth());
  //Define the grid columns (in number of cells);
  var columns:Number = 4;
  //Define the item hSpacing;
  var hSpacing:Number = 10;
  //Define the item hSpacing;
  var vSpacing:Number = 10;
  //position clip
  newClip._x = 50;
  newClip._y = 10;
  newClip._x += ((i%columns))*(newClip._width+hSpacing);
  newClip._y += Math.floor(i/columns)*(newClip._height+vSpacing);
  //populate template clip
  newClip.textField_txt.text = textNode;
  newClip.imageHolder.loadMovie(imgNode);
  newClip.btn.onPress = function() {
   getURL(linkNode, "_blank");
  };
 }
};
myXML2.load("data2.xml");
stop();

```

Button AS2 on frame 1

```auto
on (release) {
 nextFrame();
}

```

Button AS2 on frame 2

```auto
on (release) {
 prevFrame();
}

```

My issue is it’s not removing the first loaded XML  
I really don’t understand how to do this…

Thx! for helping me in advance !!
