http://www.asfusion.com/blog/entry/knowing-when-the-cfform-data-arrives explains this process quite well.
<cfform name="myForm" format="flash" onload="onFormLoad()">
<cfformitem type="script">
<!--- onload function --->
function onFormLoad(){
var listener:Object = {};
//put the controls in scope to avoid calling _root
var contactList:mx.controls.DataGrid = contactList;
listener.modelChanged = function(evt):Void {
alert('Data loaded... select first item');
<!--- remove listener, so that we are not longer notified of model
changes --->
contactList.removeEventListener('modelChanged',listener);
<!--- select first item --->
if (contactList.dataProvider.length){
contactList.selectedIndex = 0;
}
}
contactList.addEventListener('modelChanged',listener);
}
</cfformitem>
<cfgrid name="contactList" query="contactsQuery" rowheaders="false">
<cfgridcolumn name="name" header="Employee Name">
<cfgridcolumn name="gender" header="Gender">
<cfgridcolumn name="age" header="Age">
</cfgrid>
</cfform>
Note, you need MX the 7.0.1 patch to use the cfformitem tag with type="script"
~Brad