Skip to main content
Participant
December 6, 2009
Answered

swapDepth in a playing movieclip (no buttons/clicking)

  • December 6, 2009
  • 1 reply
  • 329 views

Hi,

Ok, I have 2 mcs in the same layer: mc_bus and mc_cardrive.

What happens is I've used the the bus and car mcs to drive on both sides of the road in the animation (they will go across the screen then flip over and drive back within their respective mc).

When they first cross over they are layered right but because of the timing of each animation, there is a point where both are going the same way on the same side of the road. At this point the bus pulls up higher (to the side of the road to pick people up) and the car passes it. The problem is when the car passes it is registered as being behind the bus (which would be hitting people).

So i'm trying to get the car to swapDepths and come to the front Only when driving on one side of the road, so only at a certain frame reference essentially - not the entire mc.

Is there a way to use swapDepths in the midst of the animation? without having a button or key event to register it as every other tutorial ever about swapDepth uses?

Thanks

This topic has been closed for replies.
Correct answer kglad

you can use swapDepths() anytime.  but if you're using timeline tweening, using swapDepths() during the tween will probably stop the tween.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
December 6, 2009

you can use swapDepths() anytime.  but if you're using timeline tweening, using swapDepths() during the tween will probably stop the tween.

blarntAuthor
Participant
December 7, 2009

Is there another way to do this then? because swapDepths is stopping the timeline tweens that I have.

kglad
Community Expert
Community Expert
December 7, 2009

use actionscript to tween your movieclips.