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

Unable to setChildIndex of placed movieclip in Canvas document

Community Beginner ,
Apr 30, 2020 Apr 30, 2020

Copy link to clipboard

Copied

I was a long time Flash Developer and really loved using Flash/Animate for building quick user interfaces for simple puzzles and games. I have been attempting to do something seemingly incredibly simple that just won't work.

 

1. Make a movieclip with some nested movieclips, each having an instance name

2. Drag the movieclip to the stage, and give it an instance name.

3. Use mainClip.setChildIndex(object1, mainClip.numChildren - 1) to bring object1 to the front of the displaylist.

 

the child index of object1 does move to the front, but it does not render in front. This is not very helpful!

 

I have noticed, however, that if I instantiate several movieclips from the library via code, I can change their order via setChildIndex and it works as expected. But any instance named objects nested in those movieclips cannot be rendered in a different order. (once again, their indexes can be changed, but they remain rendered at the same level)

 

This seems to be a pretty basic thing to be able to layout pieces and change their depth. For example, imagine a board with pieces where you can click one. It would come to the front of the displaylist so you can drag it across the canvas on top of other objects. Can we no longer layout assets visually? 

Views

830

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 , May 01, 2020 May 01, 2020

No, don't do that.

 

Nuthman, in HTML5 Canvas documents, any changes to timeline-controlled symbols get reverted when the timeline updates, and even single-frame timelines play continuously. So all you have to do is stop() your container clips.

Votes

Translate

Translate
LEGEND ,
May 01, 2020 May 01, 2020

Copy link to clipboard

Copied

No, don't do that.

 

Nuthman, in HTML5 Canvas documents, any changes to timeline-controlled symbols get reverted when the timeline updates, and even single-frame timelines play continuously. So all you have to do is stop() your container clips.

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 ,
May 04, 2020 May 04, 2020

Copy link to clipboard

Copied

Thanks for your response! Yes, there is only one frame in my timeline.

 

However, I had aready tried using stop(); on the container clip but it doesn't seem to make a difference. In fact, I just made a very simple new Animate file with only one MC and some code in it to show an example.

 

You can see that the depth is being changed, but the rendered depth does not change. and the piece is dragged.

Here is the FLA file:

http://www.pintsizeart.com/depth.zip 

 

 

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 ,
May 04, 2020 May 04, 2020

Copy link to clipboard

Copied

LATEST

Doh! Okay, I figured it out. I was putting the stop on the timeline of the container instance itself. 

I added this.movieclip.stop(); to my main code and this actually worked. Whew, so simple yet it really got me.

 

Thanks a ton, ClayUUID!

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