Slideshow ActionScript

Hello, This is my action script (open source, if you want to modify it and fell free to use it!!) not a real expert, but I have a problem with this code.

the aim of this script is to make a slide show, loading images form an external file (called: images) they fade in, then fade out, then load the next swf in the Next Level.

–My Question is that I cannot manage to set different times when the image load to stay in the screen (1, 2, 3 sec (1000, 2000, 3000 miliseconds) and then to fade.

They Need to fade in, stay 1,2 or three seconds, and then fade out… but its not working, I used the SetIntervalID… but nothing…

after loading the 1.swf this will call a 2.swf with a different time of the image to remain, lets say 5 sec, and then this swf will call the 3.swf and remain 8 sec??

any ideas?? Will much appreciate

i’ve tried to chace the number to 2000, 6000 but nothing in this line: intervalID = setInterval(changePicture, 1);

here is the code:

photo.empty._alpha = 0;
whichPic = 2;
var level:Number = 2;
var wasDoneOnce:Boolean = false;
var intervalID:Number=5;
// fadeMode defines if you want tou use fade out(slow) or quick jump to another picture (fast)
var fadeMode:String = “fast”;

loadMovie(“images/1.jpg”, photo.empty);

_root.onEnterFrame = function() {
if (photo.empty._alpha>2 && fadeOut) {
if(fadeMode==“slow”){
photo.empty._alpha -=100;
wasDoneOnce = true;
trace(photo.empty._alpha);
} else if(fadeMode==“fast”){
//set the time of the image appearance in fast mode in miliseconds 2000 miliseconds = 2 seconds
intervalID = setInterval(changePicture, 1);
}
}
if (photo.empty._alpha<2) {
trace(“was done once”);
if(wasDoneOnce){
//set the time of the image appearance in slow mode miliseconds 2000 miliseconds = 2 seconds
intervalID = setInterval(changePicture, 1);
} else {
fadeOut = false;
fadeIn = true;
whichPic++;
}

}
if (photo.empty._alpha&lt;100 && fadeIn && !fadeOut) {
	photo.empty._alpha +=100;
} else {
	if (whichPic&gt;=6) {
		stop();
	} else {
		fadeOut = true;
	}
}

};

function changePicture():Void {
trace(“changePicture”);
delete _root.onEnterFrame;
loadMovieNum(“2.swf”, level);
clearInterval(intervalID);
}

if your orking with intervals you should take this into account:

var intervalID:Number=5;
intervalID = setInterval(changePicture, 1);

this looks ok but this should be

var intervalID = NULL;

if( !intervalID )
{
intervalID = setInterval(changePicture, 1);
}

then
if( intervalID )
{
clearInterval( intervalID );
}
intervalID = null;

this prevents an interval being called several times. In you code everytime root has an onenterframe
there will be a new interval started and the intervalid overwritten. When you then clear it it only takes out the last one you made the others will stay as gosts…

Dude, I’m sorry to say that I think you are on a non-starter with this one!

My advice to you is to go and do a tutorial on creating a slideshow (try: http://kirupa.com/developer/mx2004/xml_flash_photogallery.htm) and then expand your development from there.

And never, ever use _root.onEnterFrame again!

Hi, thax for the messager so far, :bounce: i very much appreciate it!!

for what can i replace the:

_root.onEnterFrame

line in order not to use it in my code??

and how can i make the time to work, i.e to remain a custum time 2, 3 or 6 sec… (miliseconds)

many thanx, you re a great help, i developpe the code with a friend, which is in holiday :frowning:
good work but i just need to sort the timings for each slide, i.e i need a code that calls images, with different timings and fade in/out in each!!

thx again :angel:

Well personally I think you need to look at the way you have decided to do this, but it is hard for me to recommend something as there is no point in me going into details that are ultimately too tricky for you.

You still haven’t really described what you are trying to do properly, but I understand that is difficult. The best thing to do is to zip up your files and attach them here. I’m sure someone will be able to take a look!

Honestly, the best thing to do is to find a good slideshow tutorial like the one I suggested and base your application on that.

Hi, i havent use the tutorial as the images cannot be custimize, i.e the fade in, and out and the time in wich the images stay, and i want to control fades in and out as well as time seperately.

I have achived the fade in and out, but i have not, and this is what, i need to control the time of each slide… (1000, 2000, 3000, 6000 milsec)

I attached the files, the only thing you have to do is add an image folder and put in it 5 images called 1.jpg 2.jpg 3.jpg 4.jpg and 5.jpg.

:party: take a look,

tx!!:pac: