Flex/Starling ゲームを開発していますが、Atlas Texture を使用してすべてのスプライト呼び出しを最適化したいと考えています。私の問題は、基本的なリソースを使用して明確でシンプルなコードを使用していて、実行できないことです。引数エラーが発生し、テクスチャを null にすることはできません。.getTexture メソッドが何も見つからないことは理解していますが、この問題を修正する方法がわかりません。私のコード:
[Embed(source = "Atlas_bg/AtlasBackground.xml")]
public var AtlasXml:Class
[Embed(source = "Atlas_bg/AtlasBackground.png")]
public var AtlasPng:Class
// create atlas
var texture:Texture = Texture.fromBitmap(new AtlasPng());
var xml:XML = XML(new AtlasXml());
var atlas:TextureAtlas = new TextureAtlas(texture, xml);
// display a sub-texture
var objsTexture:Texture = atlas.getTexture("star_0");// ne trouve rien
var objsImage:Image = new Image(objsTexture);
addChildAt(objsImage, 0.6);
objsImage.x = 200;
objsImage.y = 200;
XML コンテンツ:
<TextureAtlas imagePath="AtlasBackground.png">
<SubTexture name="star_0" x="2" y="2" width="20" height="20"/>
<SubTexture name="star_1" x="2" y="24" width="20" height="20"/>
</TextureAtlas>
どうも。