Flash version detection

What is the best technique/script/code for detecting the users flash version? Trying to get my hands around this idea and then use it in some projects/experiments that I have going on. I really want to learn what is the best way to do this. I have tried a few things and some worked some not so well.