How to embed pure as3 bitmap assets with flex4 (works with flex3)

In Flex3, I can compile clean as3 code and use the "embed" tags to load images. This was done by Flex by creating the BitmapAsset class.

I can still do this in Flex4.

However, there was a trick for fakeout flex3 and use my own mx.core.BitmapAsset class to remove some of the extraneous things that Flex BitmapAsset introduces into it. This is described here: http://www.ultrashock.com/forums/flex/embed-flex-assets-without-using-flex-123405.html

Unfortunately, I cannot get these tricks to work with Flex4 and get smaller file sizes. I get the error message "VerifyError: Error # 1014: Class mx.core :: BitmapAsset not found".

This error leads me to this forum and the solution described there: http://tech.groups.yahoo.com/group/flexcoders/message/148762

Following this advice, I add -static-link-runtime-shared-libraries = true, and my swf loads without errors ... but that means that I load fragments of the frame that I wanted to omit (and the file size also says).

Is there a better way to fake flex4 when it comes to using Embed?

+3
source share
2 answers

I created a test project in Flex 4 with [Embed]and fake BitmapAsset.asand see no exception:

package
{
import flash.display.Sprite;
public class EmbedTest extends Sprite
{
    public function EmbedTest()
    {
        addChild(new smile());
    }

    [Embed("smile.png")]
    private var smile:Class;
}
}

Try adding a -link-report link-report.xmlcompiler option and check the link-report.xmlfile in bin-debug.

BitmapAsset.as? , externs, external-library-path load-externs.

+1

- ?

[Embed(source="yourImage.jpg")]
private var ImageC:Class;
private var image = new ImageC();

Keith Peters .

+3

Source: https://habr.com/ru/post/1741707/


All Articles