# Loading .swfs in dynamically from a server folder

**URL:** <https://forum.kirupa.com/t/loading-swfs-in-dynamically-from-a-server-folder/11312>\
**Category:** Uncategorized\
**Created:** [January 15, 2003, 11:48am UTC](https://forum.kirupa.com/t/loading-swfs-in-dynamically-from-a-server-folder/11312 "2003-01-15T11:48:15Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonc33](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@simonc33](https://forum.kirupa.com/u/simonc33)\
**Post date:** [January 15, 2003, 11:48am UTC](https://forum.kirupa.com/t/loading-swfs-in-dynamically-from-a-server-folder/11312/1 "2003-01-15T11:48:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 12:22pm UTC](https://forum.kirupa.com/t/loading-swfs-in-dynamically-from-a-server-folder/11312/2 "2003-01-15T12:22:58Z")

</div>

```php

<?
$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()

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 12:23pm UTC](https://forum.kirupa.com/t/loading-swfs-in-dynamically-from-a-server-folder/11312/3 "2003-01-15T12:23:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 12:36pm UTC](https://forum.kirupa.com/t/loading-swfs-in-dynamically-from-a-server-folder/11312/4 "2003-01-15T12:36:40Z")

</div>

> \*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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 12:48pm UTC](https://forum.kirupa.com/t/loading-swfs-in-dynamically-from-a-server-folder/11312/5 "2003-01-15T12:48:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 9:28pm UTC](https://forum.kirupa.com/t/loading-swfs-in-dynamically-from-a-server-folder/11312/6 "2003-01-15T21:28:33Z")

</div>

\_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 :)))

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 9:38pm UTC](https://forum.kirupa.com/t/loading-swfs-in-dynamically-from-a-server-folder/11312/7 "2003-01-15T21:38:43Z")

</div>

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

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

hope i’m being usefull here 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 9:40pm UTC](https://forum.kirupa.com/t/loading-swfs-in-dynamically-from-a-server-folder/11312/8 "2003-01-15T21:40:25Z")

</div>

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

[http://www.kirupa.com/developer/mx/loading.asp](http://www.kirupa.com/developer/mx/loading.asp)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 10:46pm UTC](https://forum.kirupa.com/t/loading-swfs-in-dynamically-from-a-server-folder/11312/9 "2003-01-15T22:46:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 10:27am UTC](https://forum.kirupa.com/t/loading-swfs-in-dynamically-from-a-server-folder/11312/10 "2003-01-16T10:27:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 16, 2003, 9:29pm UTC](https://forum.kirupa.com/t/loading-swfs-in-dynamically-from-a-server-folder/11312/11 "2003-01-16T21:29:45Z")

</div>

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