PDA

View Full Version : display images in a sequence


cbs01
04-01-2003, 04:13 PM
I'm in the process of creating a template that will display images sent to flash from php (filenames). For example. I recieve 10 filenames and the duration each image should be displayed.
The images should be displayed one by one, so I want to preload all the images first and then swap them according to the duration I recieve from php.
I can figure out how many frames each images should be displayed (#sec * frames/sec), but how would I go about preloading and swapping them.
Any suggestions?

Thanks,
cbs

spriggan
04-01-2003, 04:23 PM
you can dynamicaly load images with flash 5 and MX
http://www.kirupa.com/developer/mx/loading.htm

now for swapping them you'd probaly want to swap their depths
http://www.actionscripts.org/tutorials/intermediate/swap_depths/index.shtml

but you could also set their visibilty
itemname._visible=true/false

or just remove the movie clip.
removeMovieclip(clipname)

but the problem with that is that to view it again you have to reload the image.

hope this helps

cbs01
04-01-2003, 05:24 PM
I appreciate the tuturial links, they will be useful.

So, do I set all my pictures to false except the first one, then when the 1st finishes, the 2nd is set to true, etc.

Basically, I'm asking the user, How long do you want this picture to display? They say 12sec., then actionscript displays that filename for twelve seconds(144 frames).

O.K. this is my code to load and hold 200 pictures, but I want to put a time frame on each php filename.
Could you give me some help with that?

<as>
function loadPictures(filename)
{
loadMovie (filename, "pictureHolder");
}
myData = new LoadVars();
myData.load("http://flash.php");
myData.onLoad = function(success) {
if(success){
itemStatus.text = "How long picture will display " + timer.action;
itemText.text = timer.action/12;
}else{
itemStatus.text = "Failure";
}
}

picture = new Array();
for(i=0;i<200;i++)
{
picture[i] = new array("mypic" + i + ".jpg",i*2);
}
var i=0;
//while(picture[i][0] != undefined && i < 1000)
for(i=0;i<picture.length;i++)
{
trace(" source file: " + picture[i][0]);
trace("display time: " + picture[i][1] + " ( " + Math.round(picture[i][1] / 12) + " frames )");
trace("---------------------------------------");
// i++;
}
function Main()
{
loadPictures("../cbs/" + pictures);
}
Main();

</as>

I know it's simple but I just can't think right now.


Thanks,
cbs

cbs01
04-01-2003, 05:25 PM
Basically,

Is this the right track?

cbs