2 Replies Latest reply on Mar 19, 2007 1:14 PM by eric76

    selecting random .swf files

    melissa_v
      My code loads random movie clips from the same folder of the files "17_1.swf", "17_2.swf" and so on to "17_50.swf". If I have files that don't start with "17_" but I would like to load them anyway without having to change all of these file names, is there a better way for me to write this code?

      In other words, how can I simply have it load all of the movie clips in its folder rather than just the ones named appropriately?

      Thanks
        • 1. Re: selecting random .swf files
          melissa_v Level 1
          I forgot also to ask how I can "go back" as in, load the same random movie clip I just saw if I've already clicked away from it? I have a series of clips and the user scrolls through them, but if he wants to view the previous one shown, how can I do that?
          • 2. Re: selecting random .swf files
            eric76
            The first problem u describe I suspect is alot more tricky than when u know the file name structure. I'm guessing u will have to store all the swf file names in a file that ur flash can access, or if possible let the web server return a directory content list which u could parse for *.swf files. Just see to it that u dont load the swf that u are loading from, which could in worst case lead to a loop.

            For ur second problem, you will need to keep track of the last loaded movie with a variable, like lastLoaded (which u update just before loading a new swf with lastLoaded = currentlyLoaded), or keep them in an array (if u want the possibility of multiple back clicks).