VBscript array for Flash

Status
Not open for further replies.

dormahc

Wise, Aged Ars Veteran
129
Hey gang. Was interested in creating a MP3 player in flash as a side project. I want to set it up so I can dump mp3's (with a set naming convention) into a folder on my HD and then have flash be able to output a list of choices and be able to access the songs. Tho I've never written any VBscript myself, I'm thinking that it should be able to handle the creation of an array based on whats in the folder and then output it in a format that flash can read. Has anyone done this or has a better solution?
 

Deniro

Ars Scholae Palatinae
711
Subscriptor++
Here's something to try:

Found some info at MSDN about the Files property used against a Folder object, using the FileSystemObject

Code:
[VBScript]Function ShowFileList(folderspec)
   Dim fso, f, f1, fc, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFolder(folderspec)
   Set fc = f.Files
   For Each f1 in fc
      s = s & f1.name 
      s = s &   "
"
   Next
   ShowFileList = s
End Function

Maybe you can tweak this to output the data in a format that you want. You can build a single string like done here, or use the Split function to create an array with a comma-delimited string created like in the code.

Here's the page I found:
Files Property
 
Status
Not open for further replies.