# Link Tag for Photo Gallery using XML and Flash

**URL:** https://forum.kirupa.com/t/link-tag-for-photo-gallery-using-xml-and-flash/185346
**Category:** flash
**Created:** [April 12, 2006, 5:31pm UTC](https://forum.kirupa.com/t/link-tag-for-photo-gallery-using-xml-and-flash/185346 "2006-04-12T17:31:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![SPIKEmgb](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@SPIKEmgb](https://forum.kirupa.com/u/SPIKEmgb)
#### Post date: [April 12, 2006, 5:31pm UTC](https://forum.kirupa.com/t/link-tag-for-photo-gallery-using-xml-and-flash/185346/1 "2006-04-12T17:31:13Z")

</div>

For the Photo Gallery using XML and Flash tutorial under the Flash MX Tutorials I was wondering if anyone knew how to made the link tag functional in the FLA file.

Can anyone tell me how to make the link tag from my XML functional in this actionscript?

Here is my code:

```auto
function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		image = [];
		description = [];
		thumbnails = [];
		total = xmlNode.childNodes.length;
		for (i=0; i<total; i++) {
			image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
			description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
			thumbnails* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
			thumbnails_fn(i);
		}
		firstImage();
	} else {
		content = "file not loaded!";
	}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("interactive.xml");
///////////////////////////////////// 
listen = new Object();
listen.onKeyDown = function() {
	if (Key.getCode() == Key.LEFT) {
		prevImage();
	} else if (Key.getCode() == Key.RIGHT) {
		nextImage();
	}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
	prevImage();
};
next_btn.onRelease = function() {
	nextImage();
};
///////////////////////////////////// 
p = 0;
this.onEnterFrame = function() {
	filesize = picture.getBytesTotal();
	loaded = picture.getBytesLoaded();
	preloader._visible = true;
	if (loaded != filesize) {
		preloader.preload_bar._xscale = 100*loaded/filesize;
	} else {
		preloader._visible = false;
		if (picture._alpha<100) {
			picture._alpha += 10;
		}
	}
};
function nextImage() {
	if (p<(total-1)) {
		p++;
		if (loaded == filesize) {
			picture._alpha = 0;
			picture.loadMovie(image[p], 1);
			desc_txt.text = description[p];
			picture_num();
		}
	}
}
function prevImage() {
	if (p>0) {
		p--;
		picture._alpha = 0;
		picture.loadMovie(image[p], 1);
		desc_txt.text = description[p];
		picture_num();
	}
}
function firstImage() {
	if (loaded == filesize) {
		picture._alpha = 0;
		picture.loadMovie(image[0], 1);
		desc_txt.text = description[0];
		picture_num();
	}
}
function picture_num() {
	current_pos = p+1;
	pos_txt.text = current_pos+" / "+total;
}
function thumbNailScroller() {
	// thumbnail code! 
	this.createEmptyMovieClip("tscroller", 1000);
	scroll_speed = 10;
	tscroller.onEnterFrame = function() {
		if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
			if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
				thumbnail_mc._x -= scroll_speed;
			} else if ((_root._xmouse<=(hit_left._x+40)) && (thumbnail_mc.hitTest(hit_left))) {
				thumbnail_mc._x += scroll_speed;
			}
		} else {
			delete tscroller.onEnterFrame;
		}
	};
}
function thumbnails_fn(k) {
	thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
	tlistener = new Object();
	tlistener.onLoadInit = function(target_mc) {
		target_mc._x = hit_left._x+(target_mc._width+5)*k;
		target_mc.pictureValue = k;
		target_mc.onRelease = function() {
			p = this.pictureValue-1;
			nextImage();
		};
		target_mc.onRollOver = function() {
			this._alpha = 50;
			thumbNailScroller();
		};
		target_mc.onRollOut = function() {
			this._alpha = 100;
		};
	};
	image_mcl = new MovieClipLoader();
	image_mcl.addListener(tlistener);
	image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}

```

---

<div class="post-metadata">

### Author: ![breathe](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@breathe](https://forum.kirupa.com/u/breathe)
#### Post date: [April 12, 2006, 6:02pm UTC](https://forum.kirupa.com/t/link-tag-for-photo-gallery-using-xml-and-flash/185346/2 "2006-04-12T18:02:04Z")

</div>

Does this help?

> **[XML Photo Gallery with Links, lots of Links](https://www.kirupa.com/forum/showthread.php?t=84780)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!

I got the links working through these responses.

---

<div class="post-metadata">

### Author: ![SPIKEmgb](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@SPIKEmgb](https://forum.kirupa.com/u/SPIKEmgb)
#### Post date: [April 12, 2006, 7:08pm UTC](https://forum.kirupa.com/t/link-tag-for-photo-gallery-using-xml-and-flash/185346/3 "2006-04-12T19:08:23Z")

</div>

It doesnt work for what I need to do.

Can anyone help me figure out how to enable the picture to link to an html page in a new window?

---

<div class="post-metadata">

### Author: ![SPIKEmgb](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@SPIKEmgb](https://forum.kirupa.com/u/SPIKEmgb)
#### Post date: [April 12, 2006, 7:09pm UTC](https://forum.kirupa.com/t/link-tag-for-photo-gallery-using-xml-and-flash/185346/4 "2006-04-12T19:09:00Z")

</div>

Thanks though…

Did you ever figure out how to make it work if you were linking from the picture?

---

<div class="post-metadata">

### Author: ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)
#### Post date: [April 12, 2006, 8:05pm UTC](https://forum.kirupa.com/t/link-tag-for-photo-gallery-using-xml-and-flash/185346/5 "2006-04-12T20:05:00Z")

</div>

> **[Adding links to photo slideshow](https://www.kirupa.com/forum/showthread.php?t=181891)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!

scotty(-:
