Scotty,
Sorry to trouble you again. But I’m having a bit of a problem. Since last time you helped me out I decided that rather than the pictures loading randomly i wanted them in sequence. So using the loading the array contents from the text file from your code and some other code from somewhere else in the forum, i came up with this.
My problem is that it doesnt show the first picture and says “error opening URL” then continues fine and even includes the first picture when it has gone through once. I’m guessing i have either got your text file loading bit in the wrong place or need to include something else (I am sure it I am making a basic mistake)
I have tried hard to work it out and now am stumped. My knowledge is improving but is still limited.
Here is the code i’m using:
(I hope i’ve put the tags in correctly)
this.pathToPics = "images/";
this.fadeSpeed = 20;
this.pIndex = 0;
// MovieClip methods ----------------------------------
// d=direction; should 1 or -1 but can be any number
//loads an image automatically when you run animation
loadMovie(this.pathToPics+this.pArray[0], this.photo);
MovieClip.prototype.changePhoto = function(d)
{
this.pIndex = Math.min(Math.max(0, this.pIndex), this.pArray.length);
this.pIndex++;
if (this.pIndex>=this.pArray.length)
{
this.pIndex = 0;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
// specify the movieclip to load images into
var p = this.photo;
//------------------------------------------
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function()
{
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
// load your textfile
myLV = new LoadVars();
myLV.onLoad = function() {
pArray = this.photoId.split(",");
};
myLV.load("photo.txt");
setInterval(this, "changePhoto", 3000, 1);
thanks scotty, it working now except that it still isnt finding the first picture. It reports Error opening URL “file:///E|/qemain/0” ie not including pathToPics or image0.jpg. I tried to waitamoment longer but still has trouble.
seq array fla is pretty much the same as the other without your text loading bit. It still opens for me fine.