/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package app.utils { public class Singelton { private static const m_instance:Singelton = new Singelton(SingeltonLock); public function Singelton(lock:Class) { if (lock != SingeltonLock) { throw new Error("Singelton can only be accessed through Singelton.getInstance()."); } } private static function get instance():Singelton { return m_instance; } } } internal class SingeltonLock { }