PDA

View Full Version : dynamic flash/PHP slide show


sebnewyork
05-11-2005, 04:24 AM
Hi everybody

I am trying to build a dynamic slide show in Flash and PHP.

I have the PHP side figured out:
a php script (loader.php) indexes the content of a folder (the folder containing the images) and outputs the list of images.
Then, in flash, I am using:

loadImages.onLoad = function() {
// check that totalImages has been set and sent by PHP
if (this.totalImages != undefined) {
// clear any existing values in the imagesToLoad array
imagesToLoad = new Array();
// populate the array with the images selected by PHP
for (var i=0; i < totalImages; i++) {
imagesToLoad[i] = this["image"+i];
}
}
};
// initialize variables
var loadImages:LoadVars = new LoadVars();
var imagesToLoad:Array;
// load the PHP script
loadImages.load("loader.php?ck=" + new Date().getTime());

to retreive the PHP list. Now, I don't understand that action script, but I assume it works.
The problem is, I have no idea where to go from there, that is, how to actually display the images. Are they already loaded somehow, somewehere? do I still need to load them? How would I go about loading them, at different times?

I created an MC and called it myMC, and I tried:

myMC.loadMovie(imagesToLoad[]);

this doesn't work of course... Please help!

tris
05-11-2005, 05:26 AM
myMC.loadMovie(imagesToLoad[0]); will load the first image in your list, all you need to do is create movieclips for each image to load, or load them one at a time in the same movieclip. you may also want to look at the MovieClipLoader class in the flash docs.

sebnewyork
05-11-2005, 02:55 PM
thanks, but it doesn't work.
In the script I am using (pasted in my first post) I don't understand what
loadImages is. Is "loadImages' part of a function name? Or is it a movieClip instance name?
Should I create a movieClip called loadImages on the stage, and load the images in it?