[HTML5] add image in TextField

Hi guys.

I need to add a png file in a TextField using the “htmlText” property of the TextField class.
This is a little example:

tf.htmlText = ‘< img src=“image.png” width=“100” height=“100”/ >’;

Actually, it doen’t work for me.

My fault or the img tag is not implemented in Openfl?

(I’m using the -Dcanvas export property)

Thanks a lot.

Hey Romiar.

I just checked openfl._internal.text.HtmlParser and apparently the img tag
isn’t recognized by the HTML5 target.

Yes, <img /> in htmlText is not yet supported :slight_smile:

Hi,
What is the current status of in htmlText ? Is it already supported ?

I think it’s still not supported. But that’s a poor feature. Even in full as3, I would use my own rendering system that would create textefields and Bitmap for each parts, I can share my as3 code if you really need a quick way to add img tags.

It will be cool if you can share your code . I tried to add emoji in textfield ( for chat ) , but using utf codes ( at example :slightly_smiling_face: ) is not consistent ( i.e wrong space between characters and emoji and overlapping)