A better AS3 Singleton implementation

As a developer we usually need to create libraries to reuse in various projects, most of them are of the manager style : one class (or instance) to handle all in coming tasks from various places, popular examples are : Tween engines, Loading services, 3D libraries, Sound processing library … The simplest implementation is the static-class-methods way.

I. THE STATIC CLASS METHODS IMPLEMENTATION :

Let’s have a look through a simple library class :

package {
	public class MyUtility {
		public static function methodA(): void {
			//do A things here
		}
		public static function methodB(): void {
			//do B things here
		}
	}
}

And its simple usage syntax

MyUtility.methodA();//call method A
MyUtility.methodB();//call method B

Continue reading