• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to send JS geometry back?

New Here ,
Jul 12, 2017 Jul 12, 2017

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

Views

211

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jul 12, 2017 Jul 12, 2017

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.

Votes

Translate

Translate
LEGEND ,
Jul 12, 2017 Jul 12, 2017

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 12, 2017 Jul 12, 2017

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 12, 2017 Jul 12, 2017

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 12, 2017 Jul 12, 2017

Copy link to clipboard

Copied

It worked! Thank you, Colin.

Leo

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 12, 2017 Jul 12, 2017

Copy link to clipboard

Copied

LATEST

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines