In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the example analysis of Flex event handling process, which is very detailed and has certain reference value. Friends who are interested must finish it!
Flex event handling
In the process of development, software developers only focus on the actions done by a component after responding to an event, that is, the driven actions, rather than the actions that drive events like structured linear development. Components that respond to specific events are called event listeners (EventListener).
A GUI component for interaction is predefined for events it may encounter, and software developers can write event listeners based on development requirements to respond to some or all of the event triggers, which are shown in figure 1.7. As developers, we first need to know which events are supported by a particular GUI interaction, and then we can write corresponding event listeners according to our needs.
Figure Flex event handling flow in 1.7GUI system
In examples 1.2 and 1.3, we have used the event mechanism of Flex. Flex development is based on ActionScipt objects, and events have been used as properties of Flex visualization components. We can directly set the event listening method or code for the event property of the component in MXML.
In example 1.2, we set the click property to click= "changeText ()" and write a changeText method as the listener for the click event. In this way, when you click Button, the click event of Button is triggered and the changeText method is called. In example 1.3, we copy the ActionScript script directly to click so that the entire script acts as an event listener. The event handling of Flex visual component development is very similar to the use of JavaScript scripts in HTML page development.
In Flex event handling, if we need to deal with the event source in the event listener, that is, the component that generates the event, then we need to pass the parameter event for the event listening method. For example, we can make some changes to the definition and event properties of the event listening method in example 1.2.
(1) Modification of the definition of event listening method:
PublicfunctionchangeText (event:Event): void
(2) Modification of Button event attributes:
In the modification of the Button event property, event is used as a keyword rather than a custom variable, so we can use event directly in the tag to create the event object triggered by the current component.
The ActionScript class Event builds the event source component as a member property, so that in the event listener, we can manipulate the event source component through event.
The way event property values are set in MXML is called event listener built-in. This approach is suitable for simple event handling. If you encounter complex event handling situations such as requiring the joint use of multiple event listeners, you need to apply the event registration of Flex.
The above is all the content of the article "sample Analysis of Flex event handling process". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.