ActionScript 3 not showing jpg

62 views Asked by At

Im working with Starling and im trying to show a jpg on my background, but it doesnt shows up. Here is the embed code:

[Embed(source="../media/img/backgroundmenu.jpg")]
    public static const BgWelcome:Class; 

Later on I cast it into a bitmap and make it a texture. Im getting the following error at the getter of the bitmap: ReferenceError: Error #1069: Property metaData not found on resources.Assets_BgWelcome and there is no default value. The jpg is at the exact folder, tried to place it with the absolute path, but nothing apears.

Thanks in advance.

1

There are 1 answers

0
Iggy On

Here's a nice way to go about creating a convenient container for all your graphics using starling:

public class Art {

    [Embed(source = "../textures/foo.jpg")] private static const FooBitmap:Class;
    public static var FooTexture:Texture = MakeTexture(FooBitmap);

    private static function MakeTexture(_Texture:Class):Texture {
        var bitmap:Bitmap = new _Texture();
        return Texture.fromBitmap(bitmap);
    }
}

Usage:

var foo:Image = new Image(Art.FooTexture);