Actionscript 3/Starling Can't read embedded XML



I can't seem to get this embedded XML issue solved. I can get the object but when I run a trace... trace(myXML.children()); ... I get nothing. I am using some embedded XML for a texture atlas using starling. I keep getting an error: ArgumentError: Texture cannot be null. Can you guys help? See code below.


Calling this form my menu screen...



playButton = new Button(Assets.getAtlas().getTexture("play"));


Assets.as



package
{
import flash.display.Bitmap;
import flash.utils.Dictionary;

import starling.textures.Texture;
import starling.textures.TextureAtlas;


public class Assets
{
private static var gameTextures:Dictionary = new Dictionary();
public static var gameTextureAtlas:TextureAtlas;
[Embed(source="assets/sky.png")]
private static const sky:Class;

[Embed(source="assets/atlas.png")]
public static const atlasTexture:Class;

[Embed(source="assets/atlas.xml"), mimeType="application/octet-stream")]
private static var atlasXML:Class;



public static function getAtlas():TextureAtlas
{
if(gameTextureAtlas == null){
var xml:XML = XML(new atlasXML());
var texture:Texture = getTexture("atlasTexture");
gameTextureAtlas = new TextureAtlas(texture, xml);

}

return gameTextureAtlas;

}

public static function getTexture(name:String):Texture
{

if(gameTextures[name] == undefined){
var bitmap:Bitmap = new Assets[name]();
gameTextures[name] = Texture.fromBitmap(bitmap);
}

return gameTextures[name];
}
}
}

No comments:

Post a Comment