flex osgi translated information to achieve personal 1-potomac

2011-01-12  来源:本站原创  分类:Flash  人气:83 

Flex osgi recent realization of some of their own translation of the following:

There are two events Potomac distribution mechanism:

1 using the standard flash / flex the event distribution mechanism, PotomacDispatcher extends flash.events.EventDispatcher, he provided dispatchEvent, addEventListener and removeEventListener.

Demon:

PotomacDispatcher.getInstance (). Dispatch ("myEvent", "string", 100, "string2");

2 need to declare the event classses, distribution of time to add the name of the event, and some parameters of the data.

Demon:

[Handles (event = "myEvent", global = "true")]

public function myListener (string1: String, int1: int, string2: String): void

{

...

}

[Handlers] is a common extension point, but in typical applications potomac play a very important role, this tag allows you to accept the event without the need to use addEventListener.

Handlers of the property:

Event: The string identifies the event monitor

Source: optional, events on public property, without special instructions, potomac will monitor the event, the time when the method is declared.

Gloabl: optional, true: the listener is added to the potomacDispatcher, in potomacDispatcher global events when the starting distribution.

Priority: optional, the priority of the listener.

[Handlers] can achieve the standard event distribution (to be distributed IEventDispatcher event), add [Handlers] tag specified in the current class methods can monitor a simple weaving.

[Handlers] Global events can be distributed using potomacDispatcher event, set global = "true", add the listener method to potomacDispatcher.

相关文章