# How to load from my XML?

**URL:** <https://forum.kirupa.com/t/how-to-load-from-my-xml/203947>\
**Category:** flash\
**Created:** [October 15, 2006, 9:00pm UTC](https://forum.kirupa.com/t/how-to-load-from-my-xml/203947 "2006-10-15T21:00:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bennymartensson](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bennymartensson/32/1317_2.png) [@bennymartensson](https://forum.kirupa.com/u/bennymartensson)\
**Post date:** [October 15, 2006, 9:00pm UTC](https://forum.kirupa.com/t/how-to-load-from-my-xml/203947/1 "2006-10-15T21:00:31Z")

</div>

I have this code where the first image loads fine. What should I write under my onRelease statement to make the rest of the images load? Plus a bonusquestion: is there a way to get the number of images in my XML file in order to use this info to populate my navigation buttons?

```auto

import com.mosesSupposes.fuse.*;
ZigoEngine.simpleSetup(Shortcuts, PennerEasing);

//Navigation - how many buttons
var picNum:Number = 3;

//Tweentypes
var tweentype_resize = "easeOutExpo";
var tweentype_fadeOut = "easeInSine";
var tweentype_fadeIn = "easeInSine";

//Speed of the resizing border and the picfades
var speed_resize:Number = 0.4;
var speed_fadeOut:Number = 0.4;
var speed_fadeIn:Number = 0.4;

this.nav.btn1.alphaTo(100, .5)
this.nav.btn1.enabled = false;

// navigation
for (var i = 1; i<=picNum; i++) { 
	_root.nav["btn"+i].topText_mc.text = *;
}

// buttons
function hitButton(nbrID) {
	btn = _root.nav["btn"+nbrID];
	btn.nbrID = nbrID;
	btn.onRollOver = function() {
		this.alphaTo(100, speed_fadeIn);
		}
	btn.onRollOut = function() {
		this.alphaTo(30, speed_fadeOut);
		}
	btn.onRelease = function() {
		for (var i = 1; i<15; i++) {
        	_root.nav["btn"+i]._alpha = 30;
			_root.nav["btn"+i].enabled = true;
    		this._alpha = 100;
			this.enabled = false;
		}
	}
}

for (var i = 1; i<15; i++) {
_root.hitButton(i);
}

// bildvisning
bar._visible = false;
containerMC._alpha = 0;
picinfo._alpha = 0;
containerMC.swapDepths(2);
var pArray = new Array();
var tArray = new Array();

MovieClip.prototype.loadPic = function(pic) {
	this.loadMovie(pArray[pic]);
	this._parent.onEnterFrame = function() {
		var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
		bar._visible = true;
		per = Math.round((l/t)*100);
		if (t == l && containerMC._width>0 && containerMC._height>0) {
			var w = containerMC._width, h = containerMC._height;
			resizeMe(w, h);
			bar._visible = false;
			picinfo.info.text = tArray[pic];
			delete this.onEnterFrame;
		} else {
			//bar._width = per;
			bar.preInfo.text = per+" %";
		}
	}
}

function resizeMe(w, h) {
	//border tween:
	border.tween(["_width", "_height"], [w+2, h+2], speed_resize, tweentype_resize);
	//pic and picinfo fade in:
	containerMC.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_resize);
	picinfo.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_resize);
	//pic position:
	containerMC._x = border._x+1;
    containerMC._y = border._y+1;
}

//loading pics and text:
var gallery_xml = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function(success) {
	if (success) {
		var gallery = this.firstChild;
		gallery_txt.text = gallery.attributes.info;
		for (var i = 0; i<gallery.childNodes.length; i++) {
			tArray.push(gallery.childNodes*.attributes.title);
			pArray.push(gallery.childNodes*.attributes.source);
		}
		containerMC.loadPic(0);
	} else {
		title_txt.text = "Error!";
	}
}
gallery_xml.load("gallery.xml");

//fade out pic and picinfo:
function fadeOut(pic) {
	containerMC.alphaTo(0, speed_fadeOut, tweentype_fadeOut, 0, {scope:containerMC, func:containerMC.loadPic, args:[pic]});
	picinfo.alphaTo(0, speed_fadeOut, tweentype_fadeOut);
}

```
