0
\$\begingroup\$

I'm making a simple platformer in Adobe Animate, and I need the player to be layered in front of the stage because of a gimmick in the game. Unfortunately, whenever I change the layering order, it also seems to change the order that AS3 runs the instances.

Is there any way to change the layering order without affecting the instance order, or vice-versa?

I'm only just starting with programming, so please bear in mind that I probably won't understand many of the technical terms.

Thanks in advance!

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

When you say "runs the instances" what logic specifically are you talking about?

You should not be processing game logic by looping over DisplayObject.children. That array is primarily for the display system to use. You should keep your own, separate Vector containing the instances you want, and run them in your own order, whatever that may be (e.g. sort them first).

\$\endgroup\$
0
\$\begingroup\$

Whenever you need to bring something to the top layer, you can call the this.addChild(player_mc) again. that make it come back to the top.

I hope that it has been help full.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .