forked from: Singleton
/**
* Copyright yd_niku ( http://wonderfl.net/user/yd_niku )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/wd7r
*/
// forked from kamipoo's Singleton
package {
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var singleton:Singleton = Singleton.getInstance();
}
}
}
class Singleton {
public function Singleton(key: SingletonInternal) {
if(! key ) {
new ArgumentError("error");
}
}
public static function getInstance():Singleton {
return SingletonInternal.instance;
}
}
internal class SingletonInternal {
public static var instance: Singleton = new Singleton(new SingletonInternal ());;
}