# Portfolio gallery help

**URL:** <https://forum.kirupa.com/t/portfolio-gallery-help/217338>\
**Category:** Uncategorized\
**Created:** [February 26, 2007, 3:45am UTC](https://forum.kirupa.com/t/portfolio-gallery-help/217338 "2007-02-26T03:45:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nasrin](https://avatars.discourse-cdn.com/v4/letter/n/e47774/32.png) [@nasrin](https://forum.kirupa.com/u/nasrin)\
**Post date:** [February 26, 2007, 3:45am UTC](https://forum.kirupa.com/t/portfolio-gallery-help/217338/1 "2007-02-26T03:45:38Z")

</div>

Hi all  
I,m doing a portfolio page for a company and using a external xml file to flash file , so my xml file is like this:

```
&lt;gallery name="website"&gt;
&lt;image source="portfolio_images/annual_report/ALRM_1.jpg" thumb="thumbnails/annual_report/ALRM_thumb.jpg" title="Aboriginal Legal Rights Movement (ALRM)" titl="Annual Report" url="www.thing.com" /&gt;
			
			&lt;image source="portfolio_images/annual_report/ECH_prof_1.jpg" thumb="thumbnails/annual_report/ECH_prof_thumb.jpg" title="Party" titl="test2" URL="url1ghhgg" url="inprint.com.au"/&gt;

```

\</gallery\>  
\<gallery name=“books & publications”\>  
\<image source=“portfolio\_images/book/pic5.jpg” thumb=“pics/th5.jpg” title=“Agreement”/\>  
\<image source=“portfolio\_images/book/pic6.jpg” thumb=“pics/th6.jpg” title=“Landscape”/\>  
\</gallery\>

as you see ,I have a url attribute for some of the child node , which i want to be hyperlink,I write this code for that :

var tnNr;  
spacing = 10;  
container.\_alpha = 0;  
var curLength;  
MovieClip.prototype.loadPic = function(pic, id, dd, url) {  
info.text = “”;  
info2.text= “”;  
info3.text= “”;

```
this._alpha = 0;
this.loadMovie(pic);
temp = this._parent.createEmptyMovieClip("temp2", 998);
temp.onEnterFrame = function() {
	var t = container.getBytesTotal(), l = container.getBytesLoaded();
	if (Math.round(l/t) == 1 && container._width != 0 && container._height != 0) {
		var w = container._width+spacing, h = container._height+spacing;
		border.resizeMe(w, h, id, dd, url);
		delete this.onEnterFrame;
	}
};

```

};  
MovieClip.prototype.resizeMe = function(w, h, id, dd, url) {  
var speed = 3;  
container.\_alpha = 0;  
this.onEnterFrame = function() {  
this.\_width += (w-this.\_width)/speed;  
this.\_height += (h-this.\_height)/speed;  
if (Math.abs(this.\_width-w)\<1 && Math.abs(this.\_height-h)\<1) {  
this.\_width = w;  
this.\_height = h;  
container.\_x = this.\_x-this.\_width/2+spacing/2;  
container.\_y = this.\_y-this.\_height/2+spacing/2;  
info.\_y = Math.round(this.\_y+this.\_height/2+spacing/2);  
info2.\_y = Math.round(this.\_y+this.\_height/2+spacing/2)+30;  
info3.\_y = Math.round(this.\_y+this.\_height/2+spacing/2)+60;  
client\_txt.\_y= Math.round(this.\_y+this.\_height/2+spacing/2)+30;  
project\_txt.\_y = Math.round(this.\_y+this.\_height/2+spacing/2);  
url\_txt.\_y = Math.round(this.\_y+this.\_height/2+spacing/2)+60;  
container.\_alpha += 5;  
if (container.\_alpha\>90) {  
info.text = id;  
info2.text = dd;  
//if (this.firstChild.attributesurl == “url”) {  
//URL = element.firstChild.nodeValue;

```
			info3.text = url;
			//}
			
			container._alpha = 100; 
			delete this.onEnterFrame;
		}
	}
};

```

};  
function galleryChoice(q) {  
pArray = new Array();  
tArray = new Array();  
iArray = new Array();  
iiArray = new Array();  
iiiArray = new Array();

```
my_xml = new XML();
for (var j = 0; j&lt;curLength; j++) {
	this.th_nav["thmb"+j].removeMovieClip();
}
my_xml.ignoreWhite = true;
my_xml.onLoad = function(loaded) {
	if (loaded) {
		gallery = this.firstChild.childNodes[q];
		curLength = gallery.childNodes.length;
		for (var i = 0; i&lt;gallery.childNodes.length; i++) {
			pArray.push(gallery.childNodes*.attributes.source);
			tArray.push(gallery.childNodes*.attributes.thumb);
			iArray.push(gallery.childNodes*.attributes.title);
			iiArray.push(gallery.childNodes*.attributes.titl);
			[COLOR="red"]if(gallery.childNodes*.attributes.name == "url"){
			iiiArray.push(gallery.childNodes*.attributes.url);
			}

```

[/COLOR] }  
}  
delay = setInterval(makeButtons, 50);  
};  
my\_xml.load(“gallery.xml”);  
}  
function makeButtons() {  
tnNr = 0;  
clearInterval(delay);  
for (var i = 0; i\<tArray.length; i++) {  
var thb = th\_nav.thmb.duplicateMovieClip(“thmb”+i, 1000+i);  
thb.id = i;  
thb.\_x = i%3\*70;  
thb.\_y = Math.floor(i/3)\*70;  
}  
loadButtons();  
}  
function loadButtons() {  
var tbox = th\_nav[“thmb”+tnNr].box;  
tbox.loadMovie(tArray[tnNr]);  
temp = this.createEmptyMovieClip(“tmp”+tnNr, 999);  
temp.onEnterFrame = function() {  
bt = tbox.getBytesTotal();  
bl = tbox.getBytesLoaded();  
if (bt == bl && bt\>4) {  
nextButton();  
delete this.onEnterFrame;  
}  
};  
}  
function nextButton() {  
if (tnNr\<tArray.length-1) {  
tnNr++;  
loadButtons();  
} else {  
activateButtons();  
}  
}  
function activateButtons() {  
mainButtons();  
for (var i = 0; i\<pArray.length; i++) {  
var but = th\_nav[“thmb”+i];  
but.id = i;  
but.onRelease = function() {  
container.loadPic(pArray[this.id], iArray[this.id], iiArray[this.id], iiiArray[this.id]);

```
		disButtons2(this.id);
		
	};
	client_txt._visible= true;
	project_txt._visible= true;
	//url_txt._visible= true;
}
container.loadPic(pArray[0], iArray[0], iiArray[0], iiiArray[0]);
disButtons2(0);

```

}  
butArray = new Array();  
butArray = [“gal1\_btn”, “gal2\_btn”, “gal3\_btn”, “gal4\_btn”, “gal5\_btn”, “gal6\_btn”];  
function mainButtons() {  
for (var i = 0; i\<butArray.length; i++) {  
this[butArray\*].id = i;  
this[butArray\*].onRelease = function() {  
galleryChoice(this.id);  
disButtons(this.id);  
};  
}  
}  
function disButtons2(d) {  
for (var i = 0; i\<tArray.length; i++) {  
if (i != d) {  
this.th\_nav[“thmb”+i].enabled = 1;  
this.th\_nav[“thmb”+i].box.\_alpha = 100;  
} else {  
this.th\_nav[“thmb”+i].enabled = 0;  
this.th\_nav[“thmb”+i].box.\_alpha = 50;  
}  
}  
}  
function disButtons(d) {  
for (var i = 0; i\<butArray.length; i++) {  
if (i != d) {  
this[butArray\*].enabled = 1;  
this[butArray\*].gotoAndStop(1);  
} else {  
this[butArray\*].enabled = 0;  
this[butArray\*].gotoAndStop(2);  
}  
}  
}  
disButtons(0);  
galleryChoice(0);

but the part of code with red color dosen’n work, any body know why ?my code is wrong or???  
thanks alot
