Copy link to clipboard
Copied
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?
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
That would have been a correct assumption in every previous version of Animate. Why they changed it, I don't know.
Copy link to clipboard
Copied
Yep, why is a very good question!