# Embedding a Flash photo slideshow

**URL:** <https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230>\
**Category:** flash\
**Created:** [June 1, 2004, 4:44pm UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230 "2004-06-01T16:44:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteadyScene](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@SteadyScene](https://forum.kirupa.com/u/SteadyScene)\
**Post date:** [June 1, 2004, 4:44pm UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/1 "2004-06-01T16:44:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 5, 2004, 5:26pm UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/2 "2004-07-05T17:26:35Z")

</div>

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)

```auto
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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 5, 2004, 9:27pm UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/3 "2004-07-05T21:27:58Z")

</div>

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

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

```

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

```auto
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(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 6, 2004, 3:52pm UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/4 "2004-07-06T15:52:56Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 6, 2004, 5:39pm UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/5 "2004-07-06T17:39:01Z")

</div>

Can you post your files (fla+txt)?

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 9:19am UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/6 "2004-07-07T09:19:02Z")

</div>

thank you for your time!!!:pleased:

xof

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 11:53am UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/7 "2004-07-07T11:53:45Z")

</div>

My bad:stunned:  
Change the waitamoment function in:

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

```

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

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 2:32pm UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/8 "2004-07-07T14:32:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 5:21pm UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/9 "2004-07-07T17:21:13Z")

</div>

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

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

```

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 7:21pm UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/10 "2004-07-07T19:21:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 8:22pm UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/11 "2004-07-07T20:22:04Z")

</div>

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

(steadyscene: thanks for the heads-up!)

xof

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 9:45pm UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/12 "2004-07-07T21:45:56Z")

</div>

welcome:)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 15, 2004, 10:52am UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/13 "2004-07-15T10:52:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 15, 2004, 6:49pm UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/14 "2004-07-15T18:49:51Z")

</div>

Can you post your fla’s?

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 15, 2004, 9:02pm UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/15 "2004-07-15T21:02:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 15, 2004, 9:48pm UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/16 "2004-07-15T21:48:57Z")

</div>

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

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 16, 2004, 7:25am UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/17 "2004-07-16T07:25:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 16, 2004, 8:01am UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/18 "2004-07-16T08:01:37Z")

</div>

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

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

```

And in the slides:

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

```

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

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 16, 2004, 8:35am UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/19 "2004-07-16T08:35:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 16, 2004, 8:39am UTC](https://forum.kirupa.com/t/embedding-a-flash-photo-slideshow/53230/20 "2004-07-16T08:39:37Z")

</div>

no problem;)
