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
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?
Hope someone could throw some ideas here!