How can I addchild to a layer rather than the stage?

New Here ,
Aug 03, 2020 Aug 03, 2020

Copy link to clipboard

Copied

Im creating an animation where the user can click to add elements to the screen but the issue is whenever the user clicks the element is stuck relative to the stage not the background (the element moves with the stage) and Im not sure how to fix this

 

function fl_MouseClickHandler_4()
{
// Start your custom code
// This example code displays the words "Mouse clicked" in the Output panel.
var fl_MyInstance_4 = new lib.Cloud1();

this.addChild(fl_MyInstance_4);
fl_MyInstance_4.y = stage.mouseY;
fl_MyInstance_4.x = stage.mouseX;

TOPICS
Code

Views

77

Likes

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

Adobe Community Professional , Aug 03, 2020 Aug 03, 2020
So don't add them to the stage. Create a container movieclip and add them to that instead.

Likes

Translate

Translate
Adobe Community Professional ,
Aug 03, 2020 Aug 03, 2020

Copy link to clipboard

Copied

So don't add them to the stage. Create a container movieclip and add them to that instead.

Likes

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 ,
Aug 03, 2020 Aug 03, 2020

Copy link to clipboard

Copied

how would I go about doing this ? I've never done this before thanks

Likes

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 ,
Aug 03, 2020 Aug 03, 2020

Copy link to clipboard

Copied

LATEST

thanks I got it working 

Likes

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