Posted By

GeorgeCross on 01/30/13


Tagged

singelton


Versions (?)

Singelton Class


 / Published in: ActionScript 3
 

A singleton class

  1. public class NameOfClass
  2. {
  3. private static var NameOfClass;
  4.  
  5. public function NameOfClass(s:Singelton)
  6. {
  7.  
  8. }
  9.  
  10. public static function getInstance():NameOfClass
  11. {
  12. if (!NameOfClass._instance)
  13. {
  14. NameOfClass._instance = new NameOfClass(new Singelton());
  15. }
  16.  
  17. return NameOfClass._instance;
  18. }
  19. }internal class Singelton {}

Report this snippet  

You need to login to post a comment.