[html5] render html on a Displayobject/container

Hey there !

I try to find a way to render simple html code on a container/displayObject for a canvas html5 target

The idea is to have a simple code like this :

var htmlRaw = "<p>hello world <p>";
htmlRenderer.render(htmlRaw );

the render must support <div> <p> <a> <img> and <video> tags
I already try “textfield.htmltext”, but only works on flash target

i try to use DOMelement class but i’m not sure how to use it.

so if you have any clue, i’m in !


Hi @Maousse, the html5 target should be working (bugs are possible of course) so I would encourage you to keep experimenting with that. I often refer to the Adobe docs for text field and htmlText, keeping in mind that Haxe has a slightly different syntax. You will not be able to use <video> tag, but you can use the Video class instead. Note that the DomElement in OpenFL is only for the html5 target. If you want to use very many of the HTML5 features you may wish to abandon OpenFL and simply use the JavaScript target for Haxe along with its HTMLDocument features.

hey @Confidant

thx for your quick reply.
the <img> flag for textfield.htmltext seems not working on html5 target.

htmlText feature is tag as “partial” here :

This pull request does’nt talk about the <img> tag.

So, it seems there are no easy solution to render a simple html code on a display object container with img and video.

Video class maybe do the work. I will try it.


Careful about pull requests that are 4 years old! :slight_smile:
Does the image work if you compile using -Dcanvas?
openfl test html5 -Dcanvas -debug