Skip to main content
Participating Frequently
April 2, 2007
Answered

Webcam Application

  • April 2, 2007
  • 5 replies
  • 543 views
I'm currently developing an application but am running into some troubles. I hope you guys can help me.
What I'd like to do is a webcam game, that's how it should work:
- a master movie is placed on the server
- the first person opening the swf can see the master movie, then he's asked to reproduce what he saw with his webcam
- the second person comes and sees the last recorded movie and then again has to reproduce what he saw, when he finishes he will se the master movie, to compare.
- and so on

now recording and playing all works fine, more or less, but how can I find out how many movies are there already? I thought about saving an xml with php on a simple webserver, but there has to be an easier way, a solution I can solve with FMS to read out the data in the folder.

Thanks in advance.
    This topic has been closed for replies.
    Correct answer
    You don't really need to use the filter flag.

    Let's assume you're running the default instance of your application, and the streams are being saved in streams/_definst_. You could do something like this:

    fileObject = new File("streams/_definst_");
    fileList = fileObject.list();
    for (a=0; a<fileObject.length; a++){
    trace("File found "+fileList.name);
    }
    }
    McKeanAuthor
    Participating Frequently
    April 5, 2007
    Thanks fguru, since I got it to work without a shared object, I'll keep it in mind though since performance won't really matter...

    Jay, I was playing around with it for a while and I never knew that I had to restart the application once I changed it (stupid me) and I didn't know that I can return arrays, so I returned a comma separated string and parsed it on the client, I also had to get rid of all the subfolders since it gave me the files like folder/folder/file.flv, and for playback I had to leave away the .flv dunno why you have to do that...

    well, thanks for all the help I really appreciate it, I'm slowly getting to like fms =)
    McKeanAuthor
    Participating Frequently
    April 4, 2007
    sorry to bother again, I placed the code into my fla:

    function doConnect() {
    client_nc = new NetConnection();
    client_nc.onStatus = function(info) {
    trace("Level: "+info.level+newline+"Code: "+info.code);
    fileObject = new File("streams/_definst_");
    fileList = fileObject.list();
    trace(fileList);
    for (a=0; a<fileObject.length; a++) {
    trace("File found "+fileList.name);
    }
    };
    client_nc.connect("rtmp://192.168.1.42/sample_room");
    }

    I think I'm doing something wrong here...
    Where do I have to place this?

    Thanks!
    McKeanAuthor
    Participating Frequently
    April 3, 2007
    Thanks a lot mate!
    I'll give it a try.
    McKeanAuthor
    Participating Frequently
    April 2, 2007
    Thank you for your reply Jay!

    how could i read out the files?
    with fileObject.list(filter) ?
    I will have to place this on the application .asc file?
    or can i put this on the client side .fla ?

    thanks!
    Correct answer
    April 3, 2007
    You don't really need to use the filter flag.

    Let's assume you're running the default instance of your application, and the streams are being saved in streams/_definst_. You could do something like this:

    fileObject = new File("streams/_definst_");
    fileList = fileObject.list();
    for (a=0; a<fileObject.length; a++){
    trace("File found "+fileList.name);
    }
    }