AssetManager
Asset management for ActionScript 3.0
Install / Use
/learn @stevewoolcock/AssetManagerREADME
AssetManager
####A lightweight ActionScript 3.0 asset management solution
Description
AssetManager is a simple, yet flexible, solution to asset management for AS3 projects.
It provides a clean, simple and well documented API to allow you to focus on building your projects quickly without having to worry about how to load, store and retrieve assets.
AssetManager contains a simple plugin architecture for file formated to keep the footprint low. A default import of AssetManager with no custom plugins activated weighs in at around 8.3kb.
Features
- Clean and simple API
- Global and local loading queues
- Nestable queues
- Simple purging system for managing garbage collection and keeping memory usage in check
- Priority system for controlling loading priority of individual assets and nested queues
- Ability to store any valid ActionScript object, so all assets, internal or external, can be managed through AssetManager
- Support for XML formatted asset lists
- Plugin architecture for handling different data and file formats. Included format handlers are:
- Binary
- Images (PNG, GIF and JPEG)
- Sound (MP3)
- SWF
- XML
- GZIP (requires Paul Robertson's Actionscript GZIP encoding library)
- Name/value pairs
- Adobe Pixel Blender Shaders
- Easily extendable with plugin architecture to support any format
- Suitable for use in both small projects and large enterprise level projects
Future Additions
- Support for loading and decompressing of ZIP archives
Quick API Examples
Load an external asset and listen for completion:
var assetManager:AssetManager = AssetManager.getInstance();
assetManager.addEventListener(AssetEvent.QUEUE_COMPLETE, onQueueComplete, false, 0, true);
assetManager.add("assets/image1.jpg");
assetManager.add("assets/sound.mp3");
Retrieving a loaded asset:
var bmd:BitmapData = AssetManager.getInstance().get("assets/image1.jpg").asset;
Load an asset with a custom high priority:
AssetManager.getInstance().add("myChildSWF.swf", { priority: 5 } );
Load a single asset and execute a callback upon completion:
AssetManager.getInstance().add("image.png", {
onComplete: function():void
{
trace("Asset complete:", AssetManager.getInstance().get("image.png"));
}
});
Remove a loading, or previously loaded asset:
AssetManager.getInstance().purge("image.png");
Remove all loaded and currently loading assets:
AssetManager.getInstance().purge();
See the example projects for more examples and advanced features.
Documentation
Contribute
AssetManager is MIT-licensed. Please let me know of any issues and problems you encounter. Feel free to submit suggestions or pull-requests with new features or fixes.
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
