开发者

Is there a way to add text to sprite or movieclip not using TextField class?

开发者 https://www.devze.com 2023-01-11 17:54 出处:网络
Is there a way to add text programmatically in as3 to a Sprite or a MovieClip without using the class TextField

Is there a way to add text programmatically in as3 to a Sprite or a MovieClip without using the class TextField

TextField inherits from InteractiveObject which is kind of heavy for what I want to do: just display text (i.e. I don't want to interact with the text).

Note: I'm aware that ther开发者_运维问答e is a property selectable to make the textfield not selectable. This is not the point.

Thank you


There are two ways that come to mind. The first being this whereby a string is written to bitmap data: How to draw a string on BitmapData

Second, you could try this fast font rendering library (although I have not tried it myself) lab.polygonal.de/2009/12/15/font-rendering-with-the-fp10-drawing-api/

Both these solutions seem to bypass the need for creating a textfield (except the first where it gets used to create but then is discarded).

0

精彩评论

暂无评论...
验证码 换一张
取 消