Search code examples
flashapache-flexactionscriptmxmlc

Why does mxmlc Incremental Compile cause a fault relating to particular embedded asset?


I have a swf which embeds around 40 various png and fxg objects using the embed metatag... eg.:

public class OneOfMyEbeddedAssets
{
    [Embed(source = "./assets/OneOfMyEbeddedAssets.png")]
    private static const shapeClass: Class; 

    public static function get bitmapData():BitmapData
    {
        var bm:Bitmap = new shapeClass();
        return bm.bitmapData;
    }
}

When it compiles with the incremental tag, I notice a number of classes and fxgs are recompiled each time, saying "Reason: one of the assets has been updated", or "Reason: It's dependent file, .as has been updated". The build completes successfully.

Then, when I run my application, I get a message in the flash log:

[Fault] exception, information=ReferenceError: Error #1065: Variable
OneOfMyEbeddedAssets_shapeClass is not defined.

When I explore the swf file, and look at the Symbols embedded in it, I can see the required shape class has actually been embedded properly. The message is not for every embedded asset, just one in particular; and not necessarily the first one accessed in the code.

The problem disappears if I don't do an incremental compile... any ideas why?


Solution

  • This is a bug.

    I found the exact reproduction steps so hopefully this bug can get upvoted and fixed.