Embedding a Flash photo slideshow

Browsing around the forums I saw bits and peices of what I want to accomplish, but not quite.

I need to create a flash photo slidshow that is 129 x 174 (this is the size of the splice from the webpage) and embed it into my html site.

Requirements:

  • externally load jpg’s that reside on the server - RANDOMLY
  • jpgs must be easily added, changed (edited in notepad for end user)
  • no buttons required
  • jpgs must fade in every 15 seconds or so

Has anyone seen this? If so, I would need some assistance and the code.

Regards,

Daniel

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);

Your help is really appreciated.

Xof.

It takes a (very) little time to load the textfile and define the array.
So the moment flash executes this line:

loadMovie(this.pathToPics+this.pArray[0], this.photo);

pArray is still undefined…
Try this (don’t forget to skip the original line)

myLV = new LoadVars();
myLV.onLoad = function() {
    pArray = this.photoId.split(",");
id=setInterval(waitamoment,50);
};
myLV.load("photo.txt");
function waitamoment(){
loadMovie(this.pathToPics+this.pArray[0], this.photo);
clearInterval(id);
}

Not tested, but give it chance;)

scotty(-:

Thanks Scotty, just tried it and it tells me that it cant find the file. It isnt putting in the pathToPics or the image filename just the number 0 when it is trying to load the image. Then it doesnt seem to be doing anything! Any ideas?

Can you post your files (fla+txt)?

scotty(-:

thank you for your time!!!:pleased:

xof

My bad:stunned:
Change the waitamoment function in:

function waitamoment() {
	photo.loadMovie(this.pathToPics+pArray[0]);
	clearInterval(id);
}

And it will work:)
btw I couldn’t open your sequence array fla?

scotty(-:

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.

Thank you.
Xof

Xof, sorry, sorry, sorry :snooze:
This is the correct code [size=1](this time tested with pictures[/size]

function waitamoment() {
        photo.loadMovie(pathToPics+pArray[0]);//removed the "this" in pathToPics
        clearInterval(id);
}

scotty(-:

also make sure the file names are lower case (jpg). Alot of thumbnail programs capitalize the extensions (JPG).

thanks scotty,
I really appreciate all your help! :beer: and your patience!!

(steadyscene: thanks for the heads-up!)

xof

welcome:)

Hi everyone. I downloaded this great slideshow system. Hope it’s not too lat to ask a question. I made several files with a slideshow and in my main movie i load each one when needed. The 1s one is ok but when i load another one, the setinterval seems not working well. The pictures loads without waiting and sometimes the pictures appear each 1/2 second. I don’t where it comes from. I didn’t change anything, i just downloaded you example and used it like that . Hope you could help me.
Thank’s.
Chris

Can you post your fla’s?

scotty(-:

Sure. The slideshow is working good but i have 3 slideshow (slide1, slide2, slide3) i call from a main movie. When i call one, it’s ok but when i load another, the pictures go crazy. I send u 1 fla but the 2 others are exactly the same with differents pictures.

Okay, I think I know what’s wrong, but to be sure I have to see the main fla as well:)

scotty(-:

Ok no problem, i send you the main fla. For the differents slideshows, just export the fla i gave u first like that : slide1.swf, slide2.swf, slide3.swf. For my example i use the same pictures in each slideshow.
Thank’s a lot for your help.

Chris

The setInterval was your problem, a few little changes:)
On your buttons change the code like this

on (release) {
	clearInterval(id);
	_root.container.loadMovie("slide1.swf");//change the swf name  
}

And in the slides:

_global.id = setInterval(this, "changePhoto", 3000);

the setinterval has now an identifier so you can clear it.

scotty(-:

Of course !!! oh thank’s a lot. I’m so stupid i didn’t think about that. I’m gonna try but i’m sute this will work. When it’s not your code you don’t even think…Thank’s again Scotty.

no problem;)