package {
public class Example {
private static var instance:Example;
public function Example(access:Access){
if (access != null) {
if (Example.instance == null){
Example.instance = this;
}
} else {
throw new Error(â€Illegal operationâ€);
}
}
//provides access to singleton instance
public static function getInstance():Example{
if (instance == null){
instance = new Example();
}
return Example;
}
}
}