Flash to PHP & PHP to Flash

I’m creating an automated flash video upload page that needs to be completed quickly - supposedly tomorrow. I pretty much have all the pieces and it’s just a matter of putting them together with baby steps until I get it right. There’s just a couple things I’m having trouble with:

  • Most importantly, I’m trying to get a flash file to get a web address from a text file list. I’m thinking that I will have to have a php file working between the text file and the flash file. I DID however create a PHP file that uploads a specified file to a directory AND writes the address with the file name on a text file in a list fashion.
    The way that I would like this to work is when a video finishes on the flash file, it will send a +1 variable to, perhaps, a PHP file. The PHP file will say, okay the number no longer equals 0, but equals 1. Line 1 on the text file has this web address. Then it sends the web address to the flash file of the next video to play. (An .flv)
    The good thing is that I’ve already created a function that makes the swf ready to play a new video. The function that will restart the player when the duration of the video is almost 100% After the player reloads it will snag the variable from the text file:

nextPageInterval = setInterval(nextPage, 1000);
function nextPage(){
if(_root.ns.time > _root.duration-(_root.duration/100)){
getURL("http://www.vectorsector.net/fullScreen/vidTest4.swf");
}
}

If you are still confused what I mean by this, the text file is really just a playlist. When one video finishes the flash file will reload (because its the only way I found it could play a new video once one finishes). I’m thinking it could do this by sending a +1 variable to a PHP file then the PHP file will select the address from a list depending what number the variable is currently at. Please let me know if this needs more explaining.

  • The 2nd thing I need to have done, is when I the client wants to delete a file, which I already created in his control panel, is to find that file name with address in the text file as well and remove it.

Here are some things to check out for what I have done with the control panel so far:

Control Panel

Just letting you know the current player is not the right one that’s posted. The file upload that adds to the text file is the jpg upload that will be changed to mpg. To add to the confusion the function in the jpg upload that adds to the list will be moved to the flv upload. If you would like to use the delete file function go ahead, just copy and paste the file name and extension with no spaces, just remember it does not delete anything of the list of the text file.

The address of the list text file is:

list.txt

Thanks.