Slideshow

With Ming, it is also possible to create slideshows using images. This simple example uses multcolor to fade one image out as it fades another image into the movie. This lesson is similar to the previous lesson in that it tiles the images and preloads them. One feature added to this movie is that each image is removed from the movie once it is no longer needed. This step is not necessary, as the multcolor function will make the image transparent. But if there are too many transparent images in one frame, the movie will start to appear choppy after a while. This line of code is used to remove an image from the swf movie altogether. One thing to remember about this line is that it will not work within a movie frame, and must be placed between frames, and outside of loops, otherwise your movie will record an error and not load at all.

$myMovie->remove($MingSpring);

I am not going to repeat the instructions on loading the tile square function and the images here, but rather show codes from where the movie frames begin. The lines below will load the first image, fading it into the frame with the multcolor function.

for($i=0; $i<50; $i++){
$myMovie->nextFrame();
$MingWinter->multColor(1.0,1.0,1.0,$i/25);
$MingWinter->moveTo(0,0);
}

You will notice that there are 50 frames while will slow the speed down to leave time for viewing the image.

The next frame, will fade out the image in the first frame ($MingWinter), and fade in the second image ($MingSpring), both within 1 frame.

for($i=0; $i<50; $i++){
$myMovie->nextFrame();
$MingWinter->multColor(1.0,1.0,1.0,1.0-$i/25);
$MingSpring->multColor(1.0,1.0,1.0,$i/25);
$MingSpring->moveTo(0,0);
}

You can download all files needed for this lesson.


Result:
Refresh Animation