[AS3 && PHP] Responding to download completion

I have a very processor-intensive program written in AS3 that outputs video. In order to save this video, I’ve written code to download each frame of the video. In a nutshell, PNG image data is sent to a php program, which causes it to download as a file.

This process will eventually be replaced once I familiarize myself with AIR, but for now it works well. However, nine frames out of every ten in the video get “dropped”– they aren’t successfully downloaded, because of timing issues between the Flash program and the PHP.

Is there a way for Flash to detect and respond to the completion of the PHP process? Ideally, I’d like to know whether there is an event type I could listen to, that some sort of net object dispatches once the PHP script is finished running. Any ideas?