User Guide
114 Chapter 4: Building a Flex User Interface Visually
3.
Click the pencil icon beside the effect name.
Flex Builder performs the following tasks:
■ Switches to Split view and selects the custom effect tag in the code
■ Shows the properties of the custom effect in the Tag inspector.
4.
Set the properties of the custom effect tag in the Attributes panel or in the code.
For more information, see “Customizing an effect” in Developing Flex Applications Help.
5.
Save the file.
Related topics
• “Customizing a standard Flex effect” on page 112
• “About Flex effects” on page 109
• “Adding an effect to a component” on page 109
Assigning event handlers to components
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.
To assign an event handler to a component:
1.
If you want to use a custom event handler, define the event handler using ActionScript.
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.
2.
Select the component in the MXML file to call the event handler.
For example, a Button component is commonly assigned a handler for the click event.
3.
In the Events panel of the Tag inspector, select the event you want and enter one of the
following in the value field:
■ An object method you want to run in response to the event.
■ A function call to the ActionScript event handler you defined or referenced elsewhere in the
MXML file.
■ An ActionScript statement or group of statements separated by semi-colons that can handle
the event.
4.
If you want the event to invoke a Flex data service such as a web service, click the lightning bolt
icon beside the event’s value field and then select the data service and the method that invokes
it in the dialog box that appears.
For more information, see “Calling the data service” on page 141. 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” on page 136.