Posts Tagged PureMVC Skeleton
PureMVC Skeleton for ActionScript projects
I had previously done a PureMVC skeleton for Flash websites and applications, meaning that you would use the Flash IDE compiler to compile your project. Lately I have been doing more and more ActionScript projects (compiled using the Flex compiler but not using the Flex framework) because it permits the separation of big FLAs into smaller ones thus facilitating working in team. But I had no template/skeleton to start with until now.
So here it is:
PureMVC ActionScript Project Skeleton
It still uses an external preloader and I added a local Boolean so that the application knows your are testing locally and not on the sever (useful when making server call). One of the major change is the inclusion of the SharedAssetLibrary. Basically this emulate having one FLA with all graphics and MovieClip, but you actually can have multiple FLAs. When you want to add something to the SharedAssetLibrary you first add it to a FLA, set it to Export for ActionScript and then compile it to the swf folder. Then you can add it in the SharedAssetLibrary using the embed statment:
//BackgroundAsset being the name you gave it in the library [Embed(source="../../../swf/Background.swf", symbol="BackgroundAssets")] public var BackgroundAssets:Class;
Now if you want to use this in any of your views, first import SharedAssetLibrary and than you can use it like this:
var BackgroundAssets:Class = SharedAssetsLibrary.getInstance().getAsset("BackgroundAssets"); var assets:* = new BackgroundAssets(); addChild(Sprite(assets));
I included a FlashDevelop project file in there, but you can just delete it if you use Flash Builder.
Using a skeleton greatly reduce the setup time of a project, so I hope this will help you. I want to look into doing a skeleton for Flex Application, because I don’t like the skeleton that is available on the PureMVC website.


