Changing the depth of display objects placed on the stage

Community Beginner ,
Jan 16, 2020

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.

blue square over green squareblue square over green 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?

TOPICS
ActionScript, Code, How to

Views

372

Likes

Translate

Translate

Report

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

1 Correct Answer

Adobe Community Professional , Jan 16, 2020
ClayUUID Adobe Community Professional , Jan 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.

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Jan 16, 2020

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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Moocow AUTHOR
Community Beginner ,
Jan 16, 2020

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!

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jan 16, 2020

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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jan 16, 2020

Copy link to clipboard

Copied

Yep, why is a very good question!

Likes

Translate

Translate

Report

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