/ Published in: ActionScript 3
Easily create a SINGLE USE ONLY (Singleton) Class Object with this template.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package { public class Example { private static var instance:Example; public function Example(access:Access){ if (access != null) { if (Example.instance == null){ Example.instance = this; } } else { throw new Error(â€Illegal operationâ€); } } //provides access to singleton instance public static function getInstance():Example{ if (instance == null){ instance = new Example(); } return Example; } } }
URL: http://www.destroyyourcomputer.com