Passing data to a Flex data model

You can create bindings to pass data to data models. For example, you can create a binding to pass user input to a data model.

To create a binding to pass data to a data model:

  1. Make sure your MXML file contains a component, data model, or data service that can supply data to the data model.

    For example, your file can have a TextInput component that lets users enter employee information.

  2. In the Data panel, select the data model.
  3. In the Bindings panel (Window > Bindings), click the Plus (+) button.

    The Add Binding - Step 1 dialog box appears.

  4. Make sure the first option ("Data Will Flow To") is selected and then select the property of the data model to receive the data.

    For example, if you want to pass an employee name to the data model, select the appropriate name property of the data model.

  5. Click Next.

    The Add Binding - Step 2 dialog box appears.

  6. Select the source of the data passed to the data model.

    The source can be the property of a component, data service, or even another data model.

    For example, if you have a TextInput component that lets users enter an employee name, select the TextInput component in the left pane and then select the text:String property in the right pane.



    If you want, you can modify the binding expression in the Binding Source text box.

  7. Click Finish to create the binding.

    The new binding appears in the Bindings panel.

  8. If the source of the data is a data service such as a web service, specify the event that invokes the data service.

    For instructions, see Calling the data service.