• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Changing the depth of display objects placed on the stage

Community Beginner ,
Jan 16, 2020 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

647

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

LEGEND , Jan 16, 2020 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.

Votes

Translate

Translate
LEGEND ,
Jan 16, 2020 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.

Votes

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
Community Beginner ,
Jan 16, 2020 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!

Votes

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
LEGEND ,
Jan 16, 2020 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.

Votes

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
LEGEND ,
Jan 16, 2020 Jan 16, 2020

Copy link to clipboard

Copied

LATEST

Yep, why is a very good question!

Votes

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