swapDepths() help needed

Can anybody help me with how swapDepths() function works internally. Many times the movieclips on which i use swapDepths do not work properly.