# Help adding XML item to AS2 code

**URL:** <https://forum.kirupa.com/t/help-adding-xml-item-to-as2-code/258631>\
**Category:** flash\
**Created:** [April 25, 2008, 8:34pm UTC](https://forum.kirupa.com/t/help-adding-xml-item-to-as2-code/258631 "2008-04-25T20:34:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![schammy79](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@schammy79](https://forum.kirupa.com/u/schammy79)\
**Post date:** [April 25, 2008, 8:34pm UTC](https://forum.kirupa.com/t/help-adding-xml-item-to-as2-code/258631/1 "2008-04-25T20:34:17Z")

</div>

I just created text modules for my picture gallery, and I need some help to add them to it. I use an XML file to load up everything.

Basically, here is how my XML file is structured:

```auto
 
<gallery>
<images>
<title></title>
<description></description>
<tmb></tmb>
<txtmodule></txtmodule>
</images>
</gallery>

```

And here is the function is use to populate my gallery and its menu:

```auto
 
function loadTmbs () {
 var tmbs:XML = new XML ();
 tmbs.ignoreWhite = true;
 tmbs.onLoad = function (success) {
  if (success) {
   var root:XMLNode = this.firstChild;
   for (i = 0; i < root.childNodes.length; i++) {
    var titleTxt:String = root.childNodes*.childNodes[0].childNodes[0].nodeValue;
    var descTxt:String = root.childNodes*.childNodes[1].childNodes[0].nodeValue;
    var thumbs:String = root.childNodes*.childNodes[2].childNodes[0].nodeValue;
    var images:String = root.childNodes*.childNodes[3].childNodes[0].nodeValue;
    var txtmodule:String = root.childNodes*.childNodes[4].childNodes[0].nodeValue;
    imagesArr.push (images);
    mainmenu.containerTmbs.attachMovie ("tmb","tmb" + i,i);
    mainmenu.containerTmbs["tmb" + i]._y = i * 80;
    loadMovieClip (thumbs,mainmenu.containerTmbs["tmb" + i].containerTmb);
    mainmenu.containerTmbs["tmb" + i].titleLabel.titleText.htmlText = titleTxt
    mainmenu.containerTmbs["tmb" + i].descLabel.descText.htmlText = descTxt
    mainmenu.containerTmbs["tmb" + i].bt.idInstance = i;
    mainmenu.containerTmbs["tmb" + i].bt.onRelease = function () {
     cursorArr = this.idInstance;
     ZigoEngine.doTween (imageContainer,'_alpha',0,1,"easeOutExpo",0,function () {
     loadBitmapSmoothed (imagesArr[cursorArr],imageContainer);
     });
    };
   }
  }
  loadBitmapSmoothed (imagesArr[cursorArr],imageContainer);
  intro ();
  mainmenu.containerTmbs._y = 0 - mainmenu.containerTmbs.height / 2;
 };
 tmbs.load ("photoGallery.xml");
 
function loadBitmapSmoothed ([url:String](http://www.kirupa.com/forum/String), target:MovieClip) {
 var bmc:MovieClip = target.createEmptyMovieClip ("bmc", target.getNextHighestDepth ());
 var listener:Object = new Object ();
 listener.tmc = target;
 listener.onLoadStart = function () {
  attachMovie ("loaderMC","loaderMC",1);
  loaderMC._x = Stage.width / 2;
  loaderMC._y = Stage.height / 2;
 };
 listener.onLoadProgress = function (mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
  //percent = Math.round (bytesLoaded / bytesTotal * 100);
  //trace (percent);
 };
 listener.onLoadInit = function (mc:MovieClip) {
  imageContainer._alpha = 0;
 
  var bitmap:BitmapData = new BitmapData(mc._width, mc._height, true, 0);
  this.tmc.attachBitmap(bitmap,1,"auto",true);
  bitmap.draw(mc);
 
  attachMovie ("clock","clock",1);
  setPositions ();
 };
 var loader:MovieClipLoader = new MovieClipLoader ();
 loader.addListener (listener);
 loader.loadClip (url,bmc);
}

```

**Ideally, I want my text modules (txtmodule) to load in imageContainer on top of the images (img) associated with them and aligned to the right.**

So, any help is great… my brain is kinda pooped out right now ! You guys let me know if you need more info too… Again, **[SIZE=6][COLOR=blue]THANX A TON ! ^\_^[/COLOR][/SIZE]**
