Skip to main content
New Participant
January 16, 2020
Answered

Changing the depth of display objects placed on the stage

  • January 16, 2020
  • 1 reply
  • 905 views

I am trying to change the depth of some display objects that I have placed on the stage before hand. These display objects are also in seperate layers on the timeline. 

Right now I have a green square that is partially covered up by a blue square.

I then have: 

stage.setChildIndex(stage.green, stage.children.length - 1);

but no change. Also no change if I use: 

stage.addChild(stage.green);

or 

stage.setChildIndex(stage.blue, 0);

 I have successfully done this in the past, but those display object were created dynamically, not on the stage from the start. Maybe there is some difference there? Can anyone offer some advice?

This topic has been closed for replies.
Correct answer ClayUUID

First, the root timeline is pointed to by exportRoot, not stage.

 

Second, in CreateJS 1.0.0 (introduced in Animate 2020), even single-frame movieclips "play" continuously, which wipes out these sort of changes. Try issuing a stop() command to your container clip.

1 reply

ClayUUIDCorrect answer
Brainiac
January 16, 2020

First, the root timeline is pointed to by exportRoot, not stage.

 

Second, in CreateJS 1.0.0 (introduced in Animate 2020), even single-frame movieclips "play" continuously, which wipes out these sort of changes. Try issuing a stop() command to your container clip.

MoocowAuthor
New Participant
January 16, 2020

It was the stop() function 🙂

I guess I assumed I didn't need to add stop() since it was only a single frame but it works.

Thanks!

Brainiac
January 16, 2020

That would have been a correct assumption in every previous version of Animate. Why they changed it, I don't know.