Singelton Class


/ Published in: ActionScript 3
Save to your folder(s)

A singleton class


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.