tim richter

There are several possibilities to create swc libraries or assets. You can use embed tags wihing as-classes to force the compiler to include assets directly into your physical swf or you can use the flash IDE to link your assets in the library and publish them afterwards or at least use the flex oem compiler to compile your assets from the console.

There is a catch with all of these possibilities (in my opinion). The flash IDE is not open source, I always forget the syntax of the embed tags and using the console is failure prone.

The SWCGenerator plugin is able to create swc libraries with direct access to Bitmaps, Fonts, Sounds and ByteArrays. You can choose a specific linkage which matches the project structure.

In addition you can choose different unicode ranges and even included characters to make sure not to include unnecessary charsets. Figure 1 shows the add font dialog.

Add Font dialog
Figure 1: add font dialog

All added assets are stored in a table in a specific eclipse view.
SWCGenerator
Figure 2: SWCGenerator view

Also it is possible to save and load project settings.

There are two ways to load a project settings file:
1. by a single-click on the file in an eclipse project
2. by a single-click on the "Open Project"-Action in the toolbar.

Installation:

  1. download SWCGenerator
  2. put the .jar files in the plugins folder of your eclipse installation directory
  3. if eclipse is running restart it
  4. Window -> Show View -> Other -> Addicted2Flash -> SWCGenerator

Please drop me a comment for feature requests or bugs.

15 COMMENTS
May 28, 2009
ad

sweet! can’t wait to try it out

tim
June 3, 2009
ad

There is a bug in the flex_config path. I will fix it. Be patient.
The bug has been fixed.

June 30, 2009
ad

Hi Tim,

Is it possible to get the source code, as i plan to use it for an open source project where we need to generate an asset swc at runtime of he flex application. We dont intend to use it use it as eclipse plugin but more as a servlet. Any help would be great and thanks agian.

tim
July 19, 2009
ad

Hi Mohammed,

there is a little problem with this issue, because the swc generator need a couple of files from the flex sdk to work properly. The only way to get rid of an included sdk is the possiblity to put an executable jar in a directory relative to the sdk directory. Drop me a comment if this could be a possible solution.

August 18, 2009
ad

Hi Tim,

first of all I would like to compliment you on your idea of building this Eclipse Plugin. I think it could be very helpful on a daily basis if you are not dependent on FLA-file which can be edited by a designer.

So I just had my first test run of your SWCGenerator on my Mac. But I ran into some problems. First of all there seems to be error saving the project. When I choose a destination the path looks like this: /Users/db/DesktopTestAssets/.lib. Even when I change it to this: /Users/db/Desktop/TestAssets.lib, it fails: “Exception occurred. No such file or directory”.

The other problem is related to adding fonts to the SWC. When I try to add a TTF-font which works with the [Embed()] compiler statement it fails with this message: “Exception occurred. java.lang.ClassCastException: java.lang.Integer”.

May these be Mac-specific problems? I’m using the latest version (1.0.0) which I got from your Google Code downloads. By the way the download link on this page is leading to a non existing file. At least this is easy to fix. ;)

David

tim
August 18, 2009
ad

Hi David,

thank you for your comment. Seems to be a problem with compiling .otf-fonts. I updated the source. The other bug with the project file is also fixed. I am sorry for that.

tim
August 20, 2009
ad

It seems that the flex compiler has problems with fonts that uses specific font weight or font style. The swcgenerator is now able to parse .ttf/.otf font files to get specific information.

August 25, 2009
ad

Hi Tim,

yes, I had the same problem some time ago. Back then the feature of embedding fonts wasn’t even documented. Since then nothing has changed: http://livedocs.adobe.com/flex/3/html/help.html?content=04_OO_Programming_09.html

I fixed my problems by consulting several web sources and identified the following attributes which can/must be used to embed a font:
- fontFamily
- fontName
- fontWeight (i.e. “bold”)
- fontStyle (i.e. “normal” or “italic”)
- mimeType (i.e. “application/x-font-truetype”)
- advancedAntiAliasing (i.e. “true”)

In my case it was a lot of trial and error to find out, that for example you can set fontWeight to “medium” although you have a medium font face. This needed to be “bold” instead. All attributes except fontName are optional. If not used the compiler will spit out a specific warning. The other attributes “fontFamily”, “fontWeight” and “fontStyle” can be helpful if you want to work with embed fonts and css styles.

Maybe this can be of any help to improve your generator. If you have a question about I’ld be glad to help you.

Just checked your latest release. Saving and exporting projects now works like a charme. When I get to it I’ll try to make a test with with css styles and see if this works too with your automatic font detection.

Thx.David

tim
August 25, 2009
ad

Hi David,

thanks again for your comment. The main problem by embedding fonts is the “macStyle” tag of the font. This attribute holds information about the fontWeight and the fontStyle. To handle this automatically, I had to parse the font file header to get these informations.

Hope you enjoy the plugin.

tim
September 7, 2009
ad

* Fixed color highliting within table
* Font detecting is more reliable now

Have fun!

June 2, 2010
ad

I got an Error

ERROR MESSAGE: unable to open ‘./flex-config.xml’

tim
June 4, 2010
ad

can you reproduce the error? can you describe the steps to reproduce the bug?

Max
August 19, 2010
ad

Hi

I have copied the jar files into the pluginfolder and re started flex but I can not see view.

please help :)

tim
August 20, 2010
ad

hi max,

which java version is installed on your computer? to work properly, the swc-generator-plugin needs at least java version 1.6.

Flash Gamer
September 27, 2010
ad

Thanks for the code Tim; I was looking for this. I enjoy the Eclipse Plugin very much.

Post a comment