Created
May 29, 2013 23:05
-
-
Save schonstal/5674536 to your computer and use it in GitHub Desktop.
AS3 singleton example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
public class G | |
{ | |
public var _paused:Boolean; | |
private static var _instance:G = null; | |
private static function get instance():G { | |
if(_instance == null) { | |
_instance = new G(); | |
_instance._paused = false; | |
} | |
return _instance; | |
} | |
public static function get paused():Boolean { | |
return instance._paused; | |
} | |
public static function set paused(value:Boolean):void { | |
instance._paused = value; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment