Hi,
If you have worked with Flash & FSCommand, you must have been frustrated with its dodgy behavior. That’s because FSCommands have a MAJOR drawback.
The Flash player runs FSCommands asynchronously, after all Action Script in the frame is completed. And this limitation forces you into a complex web of work arounds. For example, let's say your application needs to check for a net connection and download a file. Using FSCommands, you might write the following code. You'll find it does NOT work. Can you figure out why?
FSCommand ("checkconnection", "connectionIsAvailable");
if (connectionIsAvailable == "true") {
// download file
} else if (connectionIsAvailable == "false") {
// do something else
}
The code fails because connectionIsAvailable does not exist. The Flash player executes the FSCommand after the native ActionScript completes (after the IF statement) and returns a value to connectionIsAvailable only after the movie advances a couple of frames.
To make this simple example work using an FSCommand-based solution, you are forced to split the code into two frames -- running the FSCommand in frame 1 and the IF statement in frame 3.