StatefulToolkit for AS3 (Beta)
Update: Don’t forget to take a look at the Introduction to using StatefulToolkit.
What is it?
The StatefulToolkit was developed to enable the simple management of states in AS3. At the heart of the toolkit is one interface called IStatable. Any object that requires the retrieval or setting of its state must implement this interface. The toolkit comes with utility classes to help carry out some of the basic tasks associated with state management.
What’s included in the beta?
The initial 0.1 beta release includes the interfaces to implement and two utility classes, one to aid in saving and loading states and another to enable clipboard management, so you can copy and paste objects.
The utility classes are both currently optimized for the Flash Player – that’s not to say they can’t be used in the AIR runtime (they’d work perfectly fine) but they take into account the security sandbox restrictions that are found in the Flash Player. For example, the FileUtil allows you to save and load states, but does this using the FileReference class whereas in an AIR application you may want this to be done silently (without the browse box appearing), which would use the File class.
Why is it in beta?
The main reason is that it’s still in early stages of development; I haven’t implemented all of the features yet and the code hasn’t been optimized, that being said it is stable in its current release. I’d also like to get some community feedback on the project before making a 1.0 release.
Where can I get it?
The source code is available at GitHub, alternatively you can download the SWC on the downloads page of the project.
Where can I find examples?
I’ll be posting tutorials for some example projects on this blog and you can find all example projects on the downloads page of the project in GitHub. This will evolve as the toolkit expands.
Where would I use it?
Essentially it can be used for any application that needs it’s state saving. However, I think it would be useful in the following type of applications:
- Wireframing applications, such as Balsamiq Mockups and LovelyCharts
- Game level editors
- Drawing tools
- General applications (for things like panel states, window positions, settings panels, etc)
What have you got planned for the future?
More utility classes! In the near future there will be a utility class to allow history management (undo and redo). Following this I want to create AIR versions of the utility classes and provide some form of automation for the setting and retrieval of states, so you don’t have to construct and parse the XML manually.
How can I help?
Feedback! Whether its feature requests, bugs, constructive criticism or just general questions about the toolkit, I want to hear it. You can either post comments on this blog, or file issues for the project at GitHub.

[...] how it can be used in a project. If you haven’t heard of StatefulToolkit before then be sure to read up on it. This example will also demonstrate use of the FileUtil, which is a utility class included in the [...]
January 24th, 2010Would you be so kind to also share the source files that are compiled into the SWC with us? State management is something we could all use, so good work!
January 28th, 2010Hi Erik,
Certainly! The source files are all hosted on GitHub [http://github.com/markstar/StatefulToolkit]. If you don’t use git you can still download the files from their using the ‘Download Source’ button, which allows you to download the files in ZIP or TAR format. The example application is also available to download on the downloads page of the project [http://github.com/markstar/StatefulToolkit/downloads]. There’ll be more examples and improvements to the toolkit soon!
Mark
P.S. I like your site!
January 28th, 2010