tom85
Threadersteller
Dabei seit: 04.07.2007
Ort: IL
Alter: 39
Geschlecht:
|
Verfasst Do 21.02.2008 10:50
Titel Nach beendeter Slideshow zu Bildnummer wechseln |
|
|
Ich würde gerne nach dem Abspielen einer Slideshow zu einer anderen Bildnummer wechseln oder einen anderen Film aufrufen.
Dies ist der Code dafür.
Code: | //the time in miliseconds, which is between images
var slideShowDelay:Number=2500;
//the number of the images, used for this slideshow gallery
//images must be in the folder images with names:1.jpg, 2.jpg, 3.jpg,..
var totalImages:Number=5;
var isSliding:Boolean=false;
//curent position
var curentPosition:Number=0;
var intervalId:Number;
var me=this;
//method used to start the slideshow
function startSlideShow()
{
isSliding=true;
showNextImage();
}
//method used to stop the slideshow
function stopSlideShow()
{
clearInterval(intervalId);
isSliding=false;
}
//method used to play the next image from the slideshow
function showNextImage()
{
loadImage(curentPosition+1);
}
//method used to play the previous image from the slideshow
function showPreviousImage()
{
loadImage(curentPosition-1);
}
/**
method used to jump to a specified index
usage: loadImage(3);
*/
function loadImage(nr:Number)
{
//cecking if the nr is between 0 and totalImage
if(nr>totalImages-1)
nr=0;
if(nr<0)
nr=totalImages;
//set the curent position to the new one
curentPosition=nr;
//start loading the new image
me.ldr.contentPath="images/"+curentPosition+".jpg";
//clear the interval used for slideshow
clearInterval(me.intervalId)
}
//a listener, used to know when the transition has finished
var obj={};
obj.onTransitionEnd=function()
{
//start the slideshow
if(me.isSliding==true)
me.intervalId = setInterval(me,"showNextImage", me.slideShowDelay )
}
ldr.addEventListener("onTransitionEnd",obj);
startSlideShow() |
Kann mir hier jemand Helfen?
|
|