# Passing XML as global values throughout the movie file

**URL:** <https://forum.kirupa.com/t/passing-xml-as-global-values-throughout-the-movie-file/88001>\
**Category:** programming\
**Created:** [April 25, 2005, 11:48pm UTC](https://forum.kirupa.com/t/passing-xml-as-global-values-throughout-the-movie-file/88001 "2005-04-25T23:48:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![surdzz](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@surdzz](https://forum.kirupa.com/u/surdzz)\
**Post date:** [April 25, 2005, 11:48pm UTC](https://forum.kirupa.com/t/passing-xml-as-global-values-throughout-the-movie-file/88001/1 "2005-04-25T23:48:12Z")

</div>

Guys, I am trying to make a photo gallery, XML driven. Thumbs get placed dynamically and upon click you get to see the full image.  
This is how it goes -

1. Load xml on first frame.
2. Pull movie clip ‘thumbs\_mc’ from the library and line it up dynamically. The code on first frame also loads a thumbsize jpg into the thumbs\_mc movieclip.  
[size=1][color=darkred]-- Works fine till this stage --[/color][/size]
3. Inside the movie clip I have onRollOver code with an animation for image\_mc.[size=2][color=black]As soon as i rollOver, the image disappears. Because of a new instance in animation. The new instance is also named image\_mc.[/color][/size]
4. I also want to load an image but the xml loaded in the first frame just looses all values. and tracing any node gives Undefined.
5. Cant flash load external ‘gifs’…?

Code on first frame -

```auto
stop();
//*/
var newThumb:MovieClip;
var spacing_V:Number = 40;
var spacing_H:Number = 40;
////////////////////////////////////
function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		image = [];
		thumb = [];
		description = [];
		total = xmlNode.childNodes.length;
		newSet = _parent.referer.createEmptyMovieClip('newSet', 'newSet', this.getNextHighestDepth());
		newSet._x = 80;
		newSet._y = 80;
		for (i=0; i<total; i++) {
			image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
			thumb* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
			description* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
			newSet.attachMovie('thumbs_mc', "thumbs_mc"+i, i);
			var newThumb = "thumbs_mc"+i;
			trace(newThumb);
			newSet[newThumb]._x = (i%6)*spacing_H;
			newSet[newThumb]._y = Math.floor(i/6)*spacing_V+100;
			//trace("imagename = "+thumb*);
		 newSet[newThumb].image_mc.loadMovie(thumb*, this.getNextHighestDepth());
		}
		//button_layout();
		//trace(total);
	} else {
		trace("file not loaded!");
	}
}
////////////////////////////////////
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");

```

Code inside Movie clip -

```auto
stop();
this.onRollOver = function()
{
	play();
}
 
this.onRollOut = function()
{
	gotoAndStop(1);
}
 
this.onRelease = function()
{
	_root.galleryImage = "scrapbook/coors01";
	_root.imageMC.gotoAndPlay("close");
	gotoAndPlay("down");
}

```

Thanks for reading this post. Any help would be appreciated.  
Surdzz
