Flex applications are event-driven. An event is generated when the user interacts with the user interface (with the mouse, for example), or when the application interacts with data. You can use Flex Builder to specify an event handler to execute when a specific event occurs. Event handlers include object methods such as ws.method.send(), and ActionScript functions.
You can write the ActionScript directly in the MXML file or in an external ActionScript file that you include in the MXML file.
If the code for the event handler is short, you can include it as a property value in the component tag. See step 3.
For example, a Button component is commonly assigned a handler for the click event.
For more information, see Calling the data service. You must insert a Flex data service in the MXML file before you can select it in this dialog box. For more information, see Working with Flex data services.