0
\$\begingroup\$

I am trying to change depths/ layers of my gameobjects inside the game using flash. To be more specific, I have a horse object and a fence object. I set them up initially on stage and the horse layer is in front of the fence which is correct like shown below

enter image description here

Now at some point in my game, the horse moves behind the fence. So the Fence layers should now be in Front. Right now, when the horse moves behind the fence, it is still in front because of course its layers has not changed like shown in image below. How do I control this using ActionScript?

enter image description here

Hope someone could throw some ideas here!

\$\endgroup\$
1
\$\begingroup\$

I figured it out.

I used the DisplayObjects function swapChildren() and it did the job!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.