In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "What is Flex Event Mechanism". The content is simple and easy to understand. It is clearly organized. I hope it can help you solve your doubts. Let Xiaobian lead you to study and learn this article "What is Flex Event Mechanism".
Flex Event Mechanism Introduction
1. What is Flex Event Mechanism
Flex events can be seen as a trigger mechanism that triggers when certain conditions are met. For example, MouseEvent refers to a series of Flex events that are triggered when the mouse is operated. Many controls have clickFlex events. This Flex event is an instance of MouseEvent. When you click the mouse, the system automatically throws a MouseEventFlex event named click (this method will be described later). If a method is registered on click at this point, it will execute when the Flex event is triggered.
As we write code, there are many different icons in the editor's code completion prompt list. Those with lightning are Flex events, three small blocks are styles, open circles are attributes, solid dots are public methods, and one is an effect.
The Flex events we can see in this list, I call them Flex event registration channels. (Officially it is still called a Flex event, but it has a different meaning than a normal Flex event.) Flex event registration channels are described below)
2. Flex event registration channel in Flex event mechanism
As mentioned above, these channels can only be seen in the code hints of mxml. Their role is to provide mxml components with registration channels for methods executed when Flex events are triggered, and they can be visible in the code hints. This provides great abstraction benefits to components. We can clearly tell the consumers of components which Flex events are included in the components for you to call.
Why treat him differently? In addition to code hints, there are some implementation differences.
Button clickFlex event is inherited from the core class InteractiveObject, unfortunately we can not see his source code, but shows that the "Flex event registration channel" can be inherited.
We'll cover how to declare Flex Event Registration Channels in Custom Flex Events.
3. Flex event trigger method in Flex event mechanism
If the registration channel is filled with a function, it means that this method will be executed when the Flex event is triggered.
click="clickHandler(event)"
We see that this method has an event object passed in as an argument, and the newcomer may ask, where did this event object come from? I didn't declare this variable either. It is actually passed to it by the register channel, and the default variable name is event. If we want to pass other parameters when Flex events are triggered, we can do so through custom Flex event objects.
This object is the Flex event object distributed by this component, an instance of MouseEvent of type "click."
This event object contains all kinds of information when the Flex event is triggered, such as which Flex event object is triggered, which listening object is, where the mouse point is triggered, etc. Different event classes will contain different attributes, such as KeyboardEvent contains which key was clicked on the keyboard.
We can also customize a Flex event class to pass our own information.
That's all for the article "What is Flex Event Mechanism?" Thanks for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to 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.