Take the 2-minute tour ×

Im embeding assets into my as3 like:

[Embed(source = "assets/images/"+assetSizeString+"/ui/left_thumb.png")]
private static const leftThumb:Class;

and I want assetSizeString to denote whether hi res or lo res assets are imported but I get the error 'Invalid Metadata'

Does anyone have any advice how to select hi or low assets using embed? Or fix this error?


share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

You'll have to use conditional compilation.

private static const leftThumb:Class;

And as a parameter to mxmlc:

mxmlc MyApplication.as \

Note: the value is surrounded by single quotes, then double quotes.

Now I imagine you have lots of assets like this in your application. Depending on how you're compiling it (mxmlc command line or ant script), I would use either a shell variable to hold the value "100px", which is then interpolated into each asset file name, or a variable within the ant script.

If you're using Flash Builder then I'm afraid you might be out of luck, but I'm not an expert on that tool so maybe there's a way.

share|improve this answer
add comment

Your Answer


