Skip to main content
Participant
August 4, 2020
Answered

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

  • August 4, 2020
  • 1 reply
  • 417 views

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;

This topic has been closed for replies.
Correct answer ClayUUID

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

1 reply

ClayUUIDCorrect answer
Legend
August 4, 2020

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

Participant
August 4, 2020

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