# Asset Library Creator

**URL:** <https://forum.kirupa.com/t/asset-library-creator/319842>\
**Category:** flash\
**Created:** [March 6, 2011, 1:21pm UTC](https://forum.kirupa.com/t/asset-library-creator/319842 "2011-03-06T13:21:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MysteryMeat](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@MysteryMeat](https://forum.kirupa.com/u/MysteryMeat)\
**Post date:** [March 6, 2011, 1:21pm UTC](https://forum.kirupa.com/t/asset-library-creator/319842/1 "2011-03-06T13:21:01Z")

</div>

Hello,

Recently i was doing some playing around with the latest flash technologies (for use in games) and found that importing assets was difficult and/or time consuming.

Long story short i created a command line app that creates a swc of embedded assets from a folder structure using compc

I’m 90% done (90% left) and am looking for your thoughts on features and things you’d like if you were using such a tool.

Even if you think it’s a terrible idea, let me know why and I’ll try to improve it.

Full disclosure, I am posting this in a few places to try and get some feedback.(but not multiple posts in the same forum)

Thank you in advance for any feedback

## Long explanation after the jump

I had a look through some resources to find the best method for doing this, the method i had settled on was to use the [embed] tag.

While this does use some flex libraries\* it seemed the easiest way to embed assets.  
\*(if anyone knows of how to remove this dependency please let me know)  
As far as workflow is concerned i needed to pull a large library of assets i already had into the solution.  
This is the time consuming part because for all of the assets i have to add a new embed tag.

After more research i found out that you can compile .AS files into an external library (SWC) using the compc compiler.  
Now armed with those two things i set about creating something that would make my life easier.

I have created a small application that recursively goes through a folder and adds each compatible asset to a swc.

[LIST]  
[_]Root  
[LIST]  
[_]file1.jpg  
[_]file2.jpg  
[_]Sub1  
[LIST]  
[\*]font1.ttf  
[/LIST]  
[/LIST]  
[/LIST]

It creates a swc from a folder while maintaining directory structure.  
This means that all the files will be embedded into the swc and have the appropriate intellisense/type safety expected.  
Each folder is represented by a package and each package has a prefix class name (configurable)  
So an AssetClass name of MyAssets would yield resources of

Root.MyAssets.file1  
Root.MyAssets.file2  
Root.Sub1.MyAssets.font1

These are get functions that return a new instance of the embedded file

Options -  
You can specify:  
• The root folder  
• The extensions that are to be embedded (whitelist) [although only from a list of extensions officially supported by the embed tag]  
• The AssetClass name (explained above)

Issues –  
Compc does not like special characters(non-alphanumeric) or spaces in its class or package names so as such these are not allowed in the directory or file names(they will be skipped).
