Make your own free website on
Reloading after swapDepths

Here is a 15 frame movie. It stops in the first frame. There are no blank or other keyframes interrupting it. Two buttons bring the movie jumping between 4th and 10th frame. Some properties are changed when it jump to 10th frame. 

Try clicking these buttons several times to observe the result. 

A ghost movieClip appears. There are two instance of movieClips on the screen now. You see, we dont have script like "duplicateMovieClip()", why Flash duplicate a movieClip for us ? And we see also in the first time, all the changes are reset when duplicated.

Usually a movieClip will not be reset or reload if it spans over the whole frames without interruption by keyframes or blank frames. However, if we script "swapDepths(500);", it is moved to a "programing virtural space". There are several consequence:


It behaves like a duplicated movieClip. It shows in front of other movieClip according to its depths value. If we have second scene, the duplicated movieClip will exists cross the scene till we removeMovieClip. Yes, after swapDepths it can be removed by removeMovieClip() now.


It loses the property of "normal" movieClip. It will still there if we goto another blank frame. Flash can not automatically unload it. When the movie play backward, Flash can not find this "normal" movieClip, so it try to reload a new one for it. Reloading would not occurr when the movie play "forward". It only occurrs when the movie play "backward".


The more complex problem is: the reload clip and the duplicate clip have the same instance name. When we script mc._y+=50; Which one will respond ?

Flash gives a method "getDepths()" to get the depth value of a movieClip. But it never gives a method "setDepths()"; Macromedia name that method as "swapDepths()"; So, it is "Swap" to get a new depths, not "Set";

It is always all right if we have two "normal" instance of movieClip and do mcA.swapDepths(mcB); It makes exchanes between two normal movieClip, exchanges within "normal depth space"; Reloading will not occurr.

What will happen if we move a movieClip into the virtual programming space ?

There is no detail documentation about this.

My experience:

If we want to move our normal clip to a virtual space (swapDepths), the _parent timeline must be single frame or only play forward to avoid this reloading side effects.

If we want our movie play with jumping here and there, then swapDepths should be combined with attached movie or duplicated movieClips to avoid reloading.