1. I have use a mxml program receive a xml to generate the Form . I need to use
"repeat " function in <mx:Repeater> as i need to check what control it need to
created. But i find that the program usually fail when run at the first time.
Can someone tell me why?

The code:

function generate_form(field_item,position){
first_time_run = 0;
if (field_item.currentItem.fieldtype == "ch"){
function_form.createChild(mx.containers.FormItem,
undefined,{id:"function_form_item",label:field_ite m.currentItem.fieldlabel,style
:"moveeffect"}).createChild(mx.controls.TextInp ut,
undefined,{id:field_item.currentItem.fieldname+"_d atainputtype_ch",styleName:"mo
veeffect"});
}
if (field_item.currentItem.fieldtype == "da"){
function_form.createChild(mx.containers.FormItem,
undefined,{id:"function_form_item",label:field_ite m.currentItem.fieldlabel,style
:"moveeffect"}).createChild(mx.controls.DateFie ld,
undefined,{id:field_item.currentItem.fieldname+"_d atainputtype_da",styleName:"mo
veeffect"});
}
if (field_item.currentItem.fieldtype == "lo"){
function_form.createChild(mx.containers.FormItem,
undefined,{id:"function_form_item",label:field_ite m.currentItem.fieldlabel,style
:"moveeffect"}).createChild(mx.controls.CheckBox,u ndefined,{id:field_item.curren
tItem.fieldname+"_datainputtype_lo",label:field_it em.currentItem.fielddefault,st
yleName:"moveeffect"});
}
}

<mx:Form id = "function_form">
<mx:Repeater id="function_form_field_repeater"
dataProvider="{httpservice_function_form.result.ar ray.item}"
repeat="generate_form(event.target);" recycleChildren="true"/>
</mx:Form>


2. i have use datagrid to generate a "table -like" container. I have use a xml
as the DataProvider. But the order of the column is reverse as the schema in
xml. Can someone tell me why?