Well, okay. In theory you can add an action hook to the 'init' action. In that function, you need to make a call to ob_start();. This will enable the output buffering. You'll also have to hook the 'shutdown' action hook and call ob_end_flush(); at that function, so the output will be sent at the end.
Then, in your plugin, wherever you do the output, you can call ob_get_contents() to get back a string containing all output made thus far. You can then search that string to see if your javascript has already been inserted into the html.
This will work, but it's not particularly advisable. It will force the webpage output to buffer in memory until all processing is complete. This is not a particularly big deal most of the time, but if you have every plugin doing it, then that's a lot of unnecessary memory usage. Using a flag is better.
Also, using Javascript to insert Flash? Bad idea. Won't work with anybody who disables javascript by default, a number which is increasing all the time. At least with more proper approaches (like an OBJECT tag), you'll get something to display. The browser should handle rendering content. Doing it with javascript is a poor approach.