I just coded something like this - a adhoc custom form builder.
I store the form definition in XML like xforms and at runtime I use
the xml to create a Flex from on the fly.
Create a empty <mx:form> tag with a ID
For each element in your xml create a form item (& control) and do a
addChild() to the formÂ… in a loop.
I created a object w/ create methods for each type of control + added
grid to layout the form for the special need I hadÂ…
Hope this helps,
Anthony
Example:
for each (var fld:XML in lvl.fld)
{
//New row in grid for each control
var gridRow:GridRow =new GridRow();
var gridItem:GridItem=new GridItem();
var itemSpacer:Spacer = new Spacer();
itemSpacer.width=curLevelNum * INDENT_LEVEL;
gridItem.addChild(itemSpacer);
//create each form control
createField(fld,gridItem);
gridRow.addChild(gridItem);
mainGrid.addChild(gridRow);
}