Copy link to clipboard
Copied
Hello,
I am creating data-driven geometry using the HTML 5 Canvas code snippets. Everything works well, except that the drawCircle geometry obscures the text from the scene. Is there any way to push the JS geometry behind the text?
Thanks in advance for your help!
Leo Casado
That is unexpected, but there's an easy work around. In a lower layer create a movieclip, at 0,0, and it doesn't have to contain anything. Give it an instance name, for example, 'holder'. Then you can do this:
this.holder.addChild(shape);
and it will appear under the text.
Copy link to clipboard
Copied
Create an empty container object for anything you draw at runtime. Place it on a lower layer than your text.
Copy link to clipboard
Copied
That is unexpected, but there's an easy work around. In a lower layer create a movieclip, at 0,0, and it doesn't have to contain anything. Give it an instance name, for example, 'holder'. Then you can do this:
this.holder.addChild(shape);
and it will appear under the text.
Copy link to clipboard
Copied
By the way, to explain my 'unexpected' comment. The code you did would add the graphics on top of the text, but I tested addChildAt(), where you should be able to add something underneath. I also tested doing an addChild() of the text, to bring it back on top. Neither trick worked, the graphics were always on top of the text.
Copy link to clipboard
Copied
It worked! Thank you, Colin.
Leo
Copy link to clipboard
Copied
I added a Helpful for ClayUUID, who came back with a faster answer, that included the main difficulty. I didn't switch Correct answer, because my one had more information, but took longer for me to type!