1
votes

When embedding assets of any size in the following manner -

[Embed(source="../../assets/Assets.swf", symbol="LargeButton")]
public static const ButtonAsset : Class;

it looks like the resulting SWF size jumps up ~2.8KB (in addition to the size of any assets that are actually embedded).

So I have a few related questions:

Is this because flex_sdk/frameworks/libs/core.swc must be statically linked? Is there any way to get around this restriction, perhaps by cherry picking the necessary files and compiling them to a SWC file?? Note that in the app I am writing file size is critical.

Is there a command/plugin that would allow for the transcompiling of vector graphics (drawn in the Flash Professional Authoring Environment) into raw ActionScript 3 ?

Use cases compelling this feature are improved workflow - would allow designers to draw assets in Flash Professional, compile to an asset SWF, and then be able to embed those assets (versus having to take the time to load them at runtime, or going to the effort myself to write them in ActionScript).

1

1 Answers

1
votes

The way you link the resource is not optimal, although 2.8K sounds a bit too much of an overhead, but let's see...

First of all, it's better to embed on class definition rather then on a constant/variable definition.

package /* ... */ {
[Embed(source="../../assets/Assets.swf", symbol="LargeButton")]
public class ButtonAsset extends Sprite { /* class definition goes here */ }
}

This will not create a FlexSpriteAsset or w/e it usually creates. However, Flex compiler isn't always able to link assets in this way. Sometimes it needs to create some additional classes, especially if animations or linestyles were used in original compiled from Flash. This functionality has also changed in different MXMLC versions, so you might have better luck with a different version, if it doesn't work with the current one.

There is this project: http://code.google.com/p/hxswfml/ that allows creating SWF graphics from an XML description - might be good, if graphics aren't very complex, but the size is of importance.