1
votes

I am building an app using Starling and have imported the scaffold project however whenever I call getTextureAtlas() it doesn't show the image

this.mLogo = new Image(Assets.getAtlasTexture("powered_by_starling"));
this.mLogo.x = 0;
this.mLogo.y = 0;
this.addChild(this.mLogo);

There are no errors so I am guessing it can find the texture. If I change the name to something that doesn't exist it throws an error 'texture cannot be null'. I am also using

Assets.contentScaleFactor = Starling.current.contentScaleFactor;

and everything is pretty much a standard import of the scaffold as is however I am using Feathers UI screen navigator but I haven't had a blank image issue on other projects.

Edit: I can't seem to get the sprite to work within a class that extends feathers.controls.Screen

2

2 Answers

0
votes

Is getAtlasTexture a function that you wrote? Are you using starlings asset manager? If that's the case, you will need a instance of that class, not static method call.

Anyway, try using the Texture class and the static method it offers. You don't need atlas(sprite sheet) for a Image - you will need it however for MovieClip.

Texture.fromBitmap
Texture.fromBitmapData

.... and others, check documentation

If your graphics are embedded, then use this:

var _img:Image = new Image(Texture.fromBitmap(new Assets.EmbeddedGraphic()));
0
votes

Are you using atf? because the same happened to me until I used png and then it worked