I have some sprites that the users can manipulate, drag around and resize. Now I'd like to be able to display text in those sprites. I've tried lots of, probably stupid, ways. Like inheriting from Label and adding a Label child to the sprite, but no text shows up.
One disturbing thing: Inheriting from Label I get the text to show up if I run in the debugger and inspect my Label subclass instance.
I have this feeling I'm missing something really obvious. How is this done, the proper way?
I would go with something more low-level than Label. Use a TextField and add it as a child to the Sprite:
var text:TextField = new TextField();
text.text = "hello world";
addChild(text);
Note: your text will not show up if the Sprite is rotated and the fonts are not embedded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With