Setting focus in Flash forms with cursor activation

Setting focus for Flash Applets in dynamic Coldfusion forms is not an easy task. This solution was inspired from one derived from a CFSilence blog article that contained the secret, which is to use a focus call to the form and then for the form to use it's onload call to the flash actionscript that does the needed focus on the form element. There are a number of possibilities here with expansion of the script into standard functions in a CFC or similar use being the logical progression/development. Enjoy.
<!--- Place the focus on the form --->
body onLoad="document.myForm.focus();">
<cfform format="flash" name="myForm" onload = "formOnLoad('login')" >
<cfinput type="text" name="login" label="A reliable way to insure form focus in Flash applets" value="" width="200">
<!--- ActionScript for the actual focus and cursor activation --->
<cfformitem type="script">
function formOnLoad(frmField:String) {
Selection.setFocus(frmField); // Set the focus
Selection.setSelection(0,_root.frmField.text.length); // Point to the field to set selection to
fscommand("activateTextField", ""); // Now activate the field!
}
</cfformitem>
</cfform>
/body
See the references at the end of this article.



Getting the Linux version of Flash Player to work with Hardy Heron (and presumably other Debian versions?) has been something of a chore for me. I was perplexed as to why I could not seem to get the installation procedure that the good folks at Adobe had created to run with my various flash videos and finally figured out a fix. As always, my goal is to share such fixes with the wider audience and I hope my recipe finds use in your installation!
