SHARE
TWEET

Untitled

a guest May 19th, 2017 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package
  2. {
  3.     public class Model extends
  4.     {
  5.         public static const SOUND_ON:String = "sound.volume.on";
  6.         public static const SOUND_OFF:String = "sound.volume.off";
  7.        
  8.         private static var instance:Model;
  9.        
  10.         private var _soundVolume:String = SOUND_ON;
  11.        
  12.         public static function getInstance():Model
  13.         {
  14.             if (Model.instance == null) Model.instance = new Model();
  15.             return Model.instance;
  16.         }
  17.        
  18.         public function get soundVolume():String
  19.         {
  20.             return _soundVolume;
  21.         }
  22.        
  23.         public function set soundVolume( v:String ):void
  24.         {
  25.             _soundVolume = v;
  26.         }
  27.     }
  28. }
  29.  
  30. package
  31. {
  32.     import src.clientname.Model;
  33.     import flash.display.*;
  34.    
  35.     public class View extends Sprite
  36.     {
  37.         public function View()
  38.         {
  39.             // set sound off
  40.             Model.getInstance().soundVolume = Model.SOUND_OFF;
  41.            
  42.             // set sound on
  43.             Model.getInstance().soundVolume = Model.SOUND_ON
  44.         }
  45.     }  
  46. }
RAW Paste Data
Challenge yourself this year...
Learn something new in 2017
Top