function init()
{
if (inited) return;
inited = true;
_container = new Sprite();
_container.name = "container";
addChild(_container);
var doc = Browser.document;
var view:DivElement = doc.createDivElement();
// the follow can not work
//_container.addChild(view);
By default, OpenFL uses one canvas element for rendering, so you cannot add a DOM element into the display list, since the whole rendering occurs only in element in the DOM.
However, using -Ddom
when compiling does use separate elements on the DOM. This should be compatible with the openfl.display.DOMSprite
class, which would look like this:
var container = new Sprite ();
addChild (container);
var div = Browser.document.createElement ("div");
var domSprite = new DOMSprite (div);
container.addChild (div);
1 Like