2014-11-21 57 views
0

我正在和Starling一起工作,我试图在我的背景上显示一个jpg,但它没有显示出来。这里是嵌入代码:ActionScript 3没有显示jpg

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

后来我把它投入到一个位图,并使其纹理。我得到以下错误在位图的吸气剂: ReferenceError: Error #1069: Property metaData not found on resources.Assets_BgWelcome and there is no default value. 该JPG是在确切的文件夹,试图把它放在绝对路径,但没有什么apears。

在此先感谢。

+0

这部分代码没有错误。请附上更多的代码 – Cherniv 2014-11-21 19:10:13

回答

0

这里是一个很好的方式去创造你的所有使用八哥图形方便的容器:

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); 
    } 
} 

用法:

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