ActionScript 3.0

Mate… Lightweight Schedule Extension

Some time ago I was in need of something to be run at regular intervals.
Among the many implementations I already had in my framework, I thought that including either my Workflow package (An ActionScript port of the Windows Workflow Foundation 3) or my processing package (eventually just a scheduling application block which allows processes to be managed Windows Service style.

I wanted something much more lightweight, so I decided to implement a Schedule Handler.
It extends the AbstractHandlers class, so all I had to do was initiate a timer and then run the sequence when the timer elapsed… more lightweight then that is hard to imagine.

package org.hellogroup.mate.actionLists
	import com.asfusion.mate.actionLists.AbstractHandlers;
	import com.asfusion.mate.actionLists.Scope;

	import flash.utils.Timer;

	public class Schedule extends AbstractHandlers
		private var timer:Timer = null;

		public function Schedule()

			this.timer = new Timer( 1000 );
			this.timer.addEventListener( TimerEvent.TIMER, this.handleTimer );

		public function get delay() : Number
			return timer.delay;

		public function set delay( value:Number ) : void
			this.timer.delay = value;

		override public function initialized( document:Object, id:String ) : void
			super.initialized( document, id );


		private function handleTimer( event:TimerEvent ) : void
			this.runSequence( new Scope( event, true, ), this.actions );

The class is included in the downloads in my previous post…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s