PDA

View Full Version : loading .swfs in dynamically from a server folder



simonc33
January 15th, 2003, 06:48 AM
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.

c0ldfusion
January 15th, 2003, 07:22 AM
<?
$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()

c0ldfusion
January 15th, 2003, 07:23 AM
i'd help you more but now i gotta go.. i'm at school :/

simonc33
January 15th, 2003, 07:36 AM
Originally posted by c0ldfusion
i'd help you more but now i gotta go.. i'm at school :/

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

Thanks

Simon

simonc33
January 15th, 2003, 07:48 AM
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

c0ldfusion
January 15th, 2003, 04:28 PM
_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 :)))

c0ldfusion
January 15th, 2003, 04:38 PM
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:%20Fl ash%20MX

hope i'm being usefull here :)

c0ldfusion
January 15th, 2003, 04:40 PM
hmm... sorry, i gave a wrong url...
the correct one is:

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

simonc33
January 15th, 2003, 05:46 PM
Thanks for your help I'll give it a try....:rambo:

simonc33
January 16th, 2003, 05:27 AM
Can't get the php script to work - can you help. Thanx

c0ldfusion
January 16th, 2003, 04:29 PM
the php script should work; you're probably messing up with the path to the folders you're using