home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Puzzle / Clusterz / Clusterz.swf / scripts / RES / WINDOWS / OWOptions.as < prev    next >
Encoding:
Text File  |  2008-09-12  |  2.6 KB  |  91 lines

  1. package RES.WINDOWS
  2. {
  3.    import ENGINE.INTERFACE.OButton;
  4.    import ENGINE.INTERFACE.ODialog;
  5.    import ENGINE.INTERFACE.OListBox;
  6.    import flash.events.Event;
  7.    import flash.system.Capabilities;
  8.    import flash.system.fscommand;
  9.    
  10.    public class OWOptions extends ODialog
  11.    {
  12.        
  13.       
  14.       public var iSound:OListBox;
  15.       
  16.       private var iSRes:Array;
  17.       
  18.       public var iCancel:OButton;
  19.       
  20.       public var iMusic:OListBox;
  21.       
  22.       private var iSResList:Array;
  23.       
  24.       public var iAccept:OButton;
  25.       
  26.       public function OWOptions()
  27.       {
  28.          super(ClusterzL.OWOptions);
  29.       }
  30.       
  31.       private function AddResolution(param1:int, param2:int) : void
  32.       {
  33.          if(param1 <= Capabilities.screenResolutionX && param2 <= Capabilities.screenResolutionY)
  34.          {
  35.             this.iSRes.push([param1,param2]);
  36.             this.iSResList.push(param1.toString() + " X " + param2.toString());
  37.          }
  38.       }
  39.       
  40.       private function InitResolutions() : void
  41.       {
  42.          this.iSRes = new Array();
  43.          this.iSResList = new Array();
  44.          AddResolution(640,480);
  45.          AddResolution(800,600);
  46.          AddResolution(1024,600);
  47.          AddResolution(1024,768);
  48.          AddResolution(1280,768);
  49.          AddResolution(1280,1024);
  50.          AddResolution(Capabilities.screenResolutionX,Capabilities.screenResolutionY);
  51.       }
  52.       
  53.       override public function Init() : void
  54.       {
  55.          super.Init();
  56.          this.iSound.prCurrentInd = int(ClusterzL.iGAME.prSoundVolume * 10);
  57.          this.iMusic.prCurrentInd = int(ClusterzL.iGAME.prMusicVolume * 10);
  58.          this.InitResolutions();
  59.       }
  60.       
  61.       override public function OnPress(param1:Event, param2:*) : void
  62.       {
  63.          if(param2 == this.iCancel)
  64.          {
  65.             this.prVisible = false;
  66.             return;
  67.          }
  68.          if(param2 == this.iAccept)
  69.          {
  70.             this.prVisible = false;
  71.             ClusterzL.iGAME.prSoundVolume = this.iSound.prCurrentInd / 10;
  72.             ClusterzL.iGAME.prMusicVolume = this.iMusic.prCurrentInd / 10;
  73.             ClusterzL.iGAME.prFullScreen = false;
  74.             fscommand("fullscreen",ClusterzL.iGAME.prFullScreen.toString());
  75.             return;
  76.          }
  77.       }
  78.       
  79.       override public function Free() : void
  80.       {
  81.          this.iSound = null;
  82.          this.iMusic = null;
  83.          this.iAccept = null;
  84.          this.iCancel = null;
  85.          this.iSRes = null;
  86.          this.iSResList = null;
  87.          super.Free();
  88.       }
  89.    }
  90. }
  91.