Home > Adobe, Flash Builder 4, Flex > Form Generation in Flash Builder 4 (Part II)

Form Generation in Flash Builder 4 (Part II)

In my previous post, we had seen how to generate forms for data types and service operations.

Now, let us generate a form for master-detail view. As we saw in the earlier post, this refers to the case where there is a control (for eg. List, ComboBox) that displays the instances of a data type and a form is generated which displays the details of the selected item in the control.

In this example, we have with us a data service named PopulationService…

… and a ComboBox which is bound to the getCountries() operation. (To know how to create the complete app from scratch, go here).

The form will retrieve the details of the selected country in the ComboBox.

So, let’s get started! Switch to Design View. Then, right-click on the ComboBox and click on ‘Generate Details Form’.

A pop-up is thrown. By default, Generate form for: Master-Detail, is selected. Ensure that ‘Make form editable’ is kept unchecked because we don’t need an editable one in this case.

In this example, the Population Service has a service called getPopulation(String) which takes as argument the name of the country, and returns the details of that country.  Hence, check ‘Call a service to get the detail data…’. Then make sure the service and operation are selected and hit Finish!

You’ll automatically be directed to the source view (to the ComboBox’s change handler). And you’ll see the following code.

protected function comboBox_changeHandler(event:ListEvent):void


getPopulationResult.token = populationService.getPopulation(/*Enter value(s) for */ strCountry);


Here, change the parameter to the getPopulation(String) operation (to comboBox.selectedItem.toString() ). So the code looks like this:

protected function comboBox_changeHandler(event:ListEvent):void


getPopulationResult.token = populationService.getPopulation(comboBox.selectedItem.toString());


As simple as that! You have yourself a details form. Adjust the position of the generated form in the design view and run the application.

More articles on using Flash Builder 4 can be found in Sujit’s Blog – http://sujitreddyg.wordpress.com/flash-builder-4/

Categories: Adobe, Flash Builder 4, Flex
  1. No comments yet.
  1. October 23, 2009 at 10:51 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: