I haven't personally used Flash for a long while, partly because of this absolute jungle of advice.
The simplest approach I've heard for non-scripted Flash detection involves hiding a very small Flash movie on an entry page. If that Flash file loads (that is, if Flash Player is present) then the Flash movie itself sends the visitor to a second page which contains the intended Flash content.
In this approach entry page also contains a meta-refresh tag. If the small Flash file hasn't redirected the visitor by the time interval indicated in the meta-refresh tag it sends the visitor to a non-Flash version of the same page.
The only downside I can see with this approach is that users with very slow connections or slow loading system might be taken to the non-Flash page before the Flash movie has a chance to load and do its re-direct. This means that you need to set the meta-refresh to a healthy interval.
I know you asked about a scripted approach, and more specifically, something on the page that simply calls an alternative file rather than a full-blown redirect. I'd love to hear from anyone who has a well tested, low failure rate script.