NSLibrary is a set of utility classes for developing pure AS3 project. It consists of several helper classes ranging from text fields to keyboard listeners. The TextField
class has invalidation and is based on TLF to work with DF4 fonts. The DataManager
class is a wrapper for the SharedObject
. RollButton
and ControlledMovieClip
allow a developer to create fancy buttons and handmade auxiliary animations.
The Transform
class helps scale and align components in dedicated frames. CurvedPath
creates complex shapes with rounded corners. The library also has SFXEngine
, which is a manager for sound channels. Finally CodeListener
and KeyListener
are keyboard helpers with some quite useful methods, such as the ability to register magic words for callback.
Sample
// Textfield //Specify base class as RollButton in the Flash Professional or create it: var button: RollButton = new RollButton(new SomeMovieClip()); var myClip: ControlledMovieClip = new SomePredefinedMovieClip(); myClip.playUntil(88); //after myClip.goTo(ControlledMovieClip.START); // DataManager //Save state, where Cache.SOUNDS, Cache.DOMAIN - some strings DataManager.getInstance().registerVar(player.isSoundsPlaying, Cache.SOUNDS, Cache.DOMAIN); //Restore state private function restoreSoundsState():Boolean { var isSet:Object = DataManager.getInstance().getValue(Cache.SOUNDS, Cache.DOMAIN); if (isSet != null) { var soundState:Boolean = Boolean(isSet); SoundMixer.soundTransform = new SoundTransform(int(soundState)); return soundState; } return true; }