Chapter 5. Displaying forms and capturing user input
This chapter covers
- Creating forms in Flex
- Using input components (controls)
- Capturing user input
Let’s put your newly acquired understanding of layout and ActionScript to work and apply it to a fundamental operation of any application—capturing user input.
As mentioned in chapter 4, even though Flex offers a Form component, its use is optional and you’ll find it functions best as a layout tool. In the land of Flex you’re equipped with visual components (usually referred to as controls) that display information and accept user input. Alongside controls are events and event handlers that recognize and respond to user actions, such as clicking a mouse.
When event handler functions run, they access data from whatever source they’ve been instructed; there’s no master Form tag that contains all the inputs as in HTML (see figure 5.1).
Figure 5.1. When a user interacts with a control, such as providing form-related input (in this case a button), you can configure an event handler (which is just a function) to handle the event. The event object provides a reference back to the source of the event via the currentTarget property, which allows the event handler function to access the source of the event directly.
