Skip to content

Instantly share code, notes, and snippets.

@k0t0vich
Created September 13, 2013 10:23
Show Gist options
  • Save k0t0vich/6548977 to your computer and use it in GitHub Desktop.
Save k0t0vich/6548977 to your computer and use it in GitHub Desktop.
Singleton mimicry
package
{
public function get SoundManager():ISoundManager
{
return _instance||= new SoundManagerImpl();
}
}
import flash.media.Sound;
var _instance:SoundManagerImpl;
class SoundManagerImpl implements ISoundManager
{
public function playSound(value:Sound):void
{
//...
}
}
//...
SoundManager.playSound(mySound);
var soundManager:ISoundManager = SoundManager;// или getSoundManager();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment