Loading .swfs in dynamically from a server folder

Do you know how I would get a viewer to add another swf dyanmically. For example I have 10 swf files that it displays in the viewer - then I upload a new swf to a flash folder, how do I tell the script to count the contents of the folder and display the total. Can anyone help - or send me a link to a script. I have MySQl and php if that helps.

Simon.


<?
$dir = opendir(".");
$i = 1;
while($file = readdir($dir))
  if(is_file($file))
     echo "&file". $i . "=" . $file;
?>

you’ll have file1, file2, …, filen as variables corresponding to your files in the current folder if you use loadVariablesNum()

i’d help you more but now i gotta go… i’m at school :confused:

*Originally posted by c0ldfusion *
**i’d help you more but now i gotta go… i’m at school :confused: **

Thanks for that - I’d be grateful if you could expand, if you have the time.

Thanks

Simon

So this basically works as follows then:

/* Returns the filenames from the directory */
<?
$dir = opendir(“flash_1”);
$i = 1;
while($file = readdir($dir))
if(is_file($file))
echo “&file”. $i . “=” . $file;
?>

on (release) {
loadVariablesNum (“filenames.php”, 0, “GET”);
}

How do I then load in the .swfs (pic1.swf, pic2.swf …)

Thanks, Si

_root.createEmptyMovieClip(“container”, 1);
loadMovie(“pic1.swf”, “container”);

//put this code for a button <on(release)>

so you have to create an empty mc and load inside it an external .swf

still have no time for this forum as I want… now i’m home and i have to do some homeworks and work on an educational software in flash (i’m being payed :)))

one idea just hit me… for learning how to learn to load .swf/s, consult kirupa.com at:

http://www.kirupa.com/developer/mx/loading.asp#Loading%20movies%20into%20target:%20Flash%20MX

hope i’m being usefull here :slight_smile:

hmm… sorry, i gave a wrong url…
the correct one is:

http://www.kirupa.com/developer/mx/loading.asp

Thanks for your help I’ll give it a try…:rambo:

Can’t get the php script to work - can you help. Thanx

the php script should work; you’re probably messing up with the path to the folders you’re using