Hi! im having problems changing my gallery that reads an xml file to one that reads a txt file. if someone can help me here i would be most grateful. the reason im doing this is because i cannot seem to create an xml via php on a server that can be edited due to permissions. if some one knows of any other way to tackle this problem i would be very glad. here is my actionscript:
spacing = 10;
containerMC._alpha = 0;
var pArray = new Array();
var tArray = new Array();
var rArray = new Array();
var cur = 0;
MovieClip.prototype.loadPic = function(pic) {
cur = pic;
containerMC._alpha = 0;
this.loadMovie(pArray[pic]);
this._parent.onEnterFrame = function() {
var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
bar._visible = 1;
per = Math.round((l/t)*100);
if (t != 0 && Math.round(l/t) == 1 && containerMC._height != 0) {
var w = containerMC._width+spacing, h = containerMC._height+spacing;
border.resizeMe(w, h);
bar._visible = 0;
picinfo.text = tArray[pic];
pichead.text = rArray[pic];
delete this.onEnterFrame;
} else {
bar._width = per;
//gives the bar a max width 100
}
};
};
MovieClip.prototype.resizeMe = function(w, h, pic) {
var speed = 3;
this.onEnterFrame = function() {
this._width += (w-this._width)/speed;
this._height += (h-this._height)/speed;
nav._x = Math.round(this._x-this._width/2);
nav._y = Math.round(this._y+this._height+spacing/2);
//if you want the next and prev button on a solid place, skip next three lines
picinfo._y = 130;
picinfo._x = 700;
pichead._y = 100;
pichead._x = 700;
if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
this._width = w;
this._height = h;
containerMC._x = this._x-this._width/2+spacing/2;
containerMC._y = this._y+spacing/2;
containerMC._alpha = 100;
delete this.onEnterFrame;
}
};
};
var gallery_xml = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function(success) {
if (success) {
var gallery = this.firstChild;
for (var i = 0; i<gallery.childNodes.length; i++) {
tArray.push(gallery.childNodes*.attributes.title);
pArray.push(gallery.childNodes*.attributes.source);
rArray.push(gallery.childNodes*.attributes.caption);
}
//loading first picture
containerMC.loadPic(0);
} else {
title_txt.text = "Error!";
}
};
gallery_xml.load("wig_gallery.xml");
prevb.onRelease = function() {
cur--;
if (cur<0) {
containerMC.loadPic(pArray.length-1);
} else {
containerMC.loadPic(cur);
}
};
nextb.onRelease = function() {
cur++;
if (cur>pArray.length-1) {
containerMC.loadPic(0);
} else {
containerMC.loadPic(cur);
}
};
and my code for xml:
<?xml version=“1.0” encoding=“UTF-8”?>
<gallery path=“animation/”>
<image title=“Leila” source=“images/photo1.jpg”/>
<image title=“Leila again” source=“images/photo2.jpg”/>
<image title=“Unknown” source=“images/photo3.jpg”/>
<image title=“Landscape 1” source=“images/photo2.jpg”/>
<image title=“Landscape 2” source=“images/photo1.jpg”/>
<image title=“Landscape 3” source=“images/photo3.jpg”/>
</gallery>
Many thanks!:te: