Highlighted

Unable to setChildIndex of placed movieclip in Canvas document

Community Beginner ,
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? 

Adobe Community Professional
Correct answer by ClayUUID | Adobe Community Professional

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.

Views

268

Likes

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

Unable to setChildIndex of placed movieclip in Canvas document

Community Beginner ,
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? 

Adobe Community Professional
Correct answer by ClayUUID | Adobe Community Professional

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.

Views

269

Likes

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
Apr 30, 2020 0
Engaged ,
May 01, 2020

Copy link to clipboard

Copied

Add a tick event and set the child index there so it gets set every frame (even if the index value doesn't actually change)

Likes

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
Reply
Loading...
May 01, 2020 0
Adobe Community Professional ,
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.

Likes

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
Reply
Loading...
May 01, 2020 1
Community Beginner ,
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 

 

 

Likes

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
Reply
Loading...
May 04, 2020 0
nuthman LATEST
Community Beginner ,
May 04, 2020

Copy link to clipboard

Copied

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!

Likes

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
Reply
Loading...
May 04, 2020 0