home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2011 May / ME_2011_05.iso / Galileo-Video-Tutorial / system / player.swf / scripts / controller / ViewShownController.as < prev    next >
Encoding:
Text File  |  2010-11-30  |  1.2 KB  |  49 lines

  1. package controller
  2. {
  3.    import flash.events.Event;
  4.    import flash.events.EventDispatcher;
  5.    
  6.    public class ViewShownController extends EventDispatcher
  7.    {
  8.       private static var _viewed:Boolean;
  9.       
  10.       private static var allowInstantiation:Boolean;
  11.       
  12.       public static var VIEWED:String = "viewed";
  13.       
  14.       private static var instance:ViewShownController = null;
  15.       
  16.       public function ViewShownController()
  17.       {
  18.          super();
  19.          if(!allowInstantiation)
  20.          {
  21.             throw new Error("Error: Instantiation failed: Use SingletonDemo.getInstance() instead of new.");
  22.          }
  23.       }
  24.       
  25.       public static function getInstance() : ViewShownController
  26.       {
  27.          if(instance == null)
  28.          {
  29.             allowInstantiation = true;
  30.             instance = new ViewShownController();
  31.             allowInstantiation = false;
  32.          }
  33.          return instance;
  34.       }
  35.       
  36.       public function set viewed(param1:Boolean) : void
  37.       {
  38.          _viewed = param1;
  39.          dispatchEvent(new Event(VIEWED));
  40.       }
  41.       
  42.       public function get viewed() : Boolean
  43.       {
  44.          return _viewed;
  45.       }
  46.    }
  47. }
  48.  
  49.