ActionScript 3.0

Mate… StopAndDispatchHandlers Extension

Some time ago I found myself in need of a couple of features not included in Mate, such as a StopHandler which would be interruptable, but instead of just returning from the entire ActionList, would dispatch an event which could be handled by another handler.

It was named StopAndDispatchHandlers and extends the standard StopHandlers.

First I created a somewhat abstract stophandlers class which overrides the run function and handles some of the more intricate details relating to the lastReturnEquals and lastReturn members of the scope object.


package org.hellogroup.mate.actions
{
	import com.asfusion.mate.actionLists.IScope;
	import com.asfusion.mate.actions.StopHandlers;

	public class StopHandlers extends com.asfusion.mate.actions.StopHandlers
	{
		public function StopHandlers()
		{
			super();
		}

		override protected function run( scope:IScope ):void
		{
			super.run( scope );

			if( lastReturnEquals == null && scope.lastReturn == null )
			{
				scope.stopRunning();
			}
		}
	}
}

Here is the concrete implementation which allows for a stophandler to dispatch an event.


package org.hellogroup.mate.actions
{
	import com.asfusion.mate.actionLists.IScope;
	import org.hellogroup.mate.actions.StopHandlers;
	import flash.events.Event;

	public class StopAndDispatchHandlers extends StopHandlers
	{
		private var _nextEvent:Event = null;

		public function StopAndDispatchHandlers()
		{
			super();
		}

		public function get nextEvent() : Event
		{
			return _nextEvent;
		}

		public function set nextEvent( value:Event ) : void
		{
			_nextEvent = value;
		}

		override protected function run( scope:IScope ):void
		{
			super.run( scope );

			scope.dispatcher.dispatchEvent( nextEvent );
		}
	}
}

You can download the compiled binary from here…
http://petermolgaard.com/projects/MateSchedule.swc.zip

…and the entire sourcecode as a Flex project from here…
http://petermolgaard.com/projects/MateSchedule.fxpl.zip

Uncategorized

Mate… the true story behind the name

The Mate Flex Framework is as many thought to be named as you were calling a buddy… but this is actually not so.

Mate (pronounced: [ˈmate]), as in the Mate Flex Framework, is actually named after an Argentinean drink and not the nickname of a buddy (even though you would be with them when you drink the “mate”).

You can read this and much more at e.g. Wikipedia who has a pretty exhaustive article about it…
http://en.wikipedia.org/wiki/Mate_(beverage)

Uncategorized

SQLServiceAndSQLServiceInvoker

Underneath the cool and sexy name “SQLServiceAndSQLServiceInvoker”, there is a really useful implementation of an AIR Data Access Layer build on top of Mate Flex Framework…

It’s nothing less than excellent, I tried taking my PureMVC implementation of my personal TimeTracker and converting it into a Mate based one… 60% less code and much much more maintainable and elegant…

Mate rocks incredibly much… and kudos to Jens Krause, Websector for creating the extension to Mate so we can connect to AIR SQLLite Databases from within our Mate applications… its really cool stuff.

Check it out…
http://code.google.com/p/mate-examples/wiki/SQLServiceAndSQLServiceInvoker