This demo is relatively simple. Keywords are sent to the Twitter API using a command that is dispatched straight from the view as it is something possible with SomaCore. A command is nothing more than a flash built-in event. The views are able to dispatch commands without accessing to a mediator first and stay completely free of framework code.
A TwitterService dispatch a search result event after getting the data. The wire responsible of the main view is listening to the search result event and update the view.
The SearchWire class demonstrates that both commands and events can be listened to from any wire.
The control of the flow of the application is also very flexible, the SearchWire class could have stopped the search command for any reason using
event.preventDefault() as the class is listening to the command (if the event is sent with a cancelable property set to true).
Any commands in SomaCore can be listened to in any wires, and can also be “default prevented”.
Credits: Inspired by a great Flex Robotlegs demo by John Lindquist, using the AS3 API library Tweetr.