[Flex] one-way communication about the process of mate flex framework

Source: Internet
Author: User

Process introduction of mate flex framework: one-way communication
Introduction to the process of mate flex framework-two-way communication
Introduction to mate flex Framework process-Introduction to listener tagmate flex Framework process-using an adapter

One-way communication about the process of the mate flex framework

There is still one article left:Introduction to the important features of mate flex framework: extensionsThis function is also a relatively advanced function of mate, but in order to help you consolidate the previous content, I plan to release the introduction of extensions first, first, introduce the process of mate framework.

This article describes a simple process: Send messages from the view to the logic layer (from veiws to business logic)Please take a look at the flowchart first: Since the source image has translated some of this simple process, but I have removed these explanations in the middle because I want to describe it in my own language, rather than English translation. Okay, let's get started: (I will combine the previous examples for translation) 1. The view will trigger a message (dispatchevent (New myevent (myevent. click_me ));) When myevent. after click_me, mate framework will send this event to a place called "event bus" (Please note: This eventbus is virtual and does not exist in our entity code, or the logical mechanism of mate)

2. Event bus will notify the event map of the triggered event ).

In event map, some event processing logic will be prepared in advance (that is, some eventhandler will be defined)3. In these defined eventhandler, there will be a group of actions to respond to this event (that is, the myevent sent from the event bus. click_me) in the previous example, the structure of the eventhandler we defined is:

<Eventhandlers type = "{myevent. click_me}">
<Methodinvoker generator = "{A}" method = "myeventhandler"/>
</Eventhandlers>
WhereBlack ItalicIs the action we want to execute (use methodinvoker to trigger the myeventhandler method in A. mxml, and we can also use other mate labels, such as input parameters .)

In addition to calling methodinvoker, serviceinvoker is also called.

4. At the same time, according to the flowchart, the first call is serviceinvoker, and some result values are returned. Then call the methodinvoker. For example, some return values obtained by calling serviceinvoker are sent to a class specified by methodinvoker.Through the above steps, a simple mate event is handled. I will summarize this simple process:First, assign myevent. click_me, and then a virtual mechanism called event bus (I think it should be the core logic of mate flex framework ), at the same time, event bus will send the assigned content to the specified eventhandler in eventmap (the assigned identifier is the real-time event type ). In eventhandler, some actions are defined and executed in a certain order (for example, adding serviceinvoker responsible for processing the service or methodinvoker for processing the method). Isn't it easy? Next time, I will introduce a slightly more complex process: bidirectional communication: Dispatch and response tags (two-way communication: Dispatcher and responsehandler tags ). Its flow chart is here: http://mate.asfusion.com/assets/content/diagrams/two_ways.png

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.