PDA

View Full Version : Layer Problems


barry_sheen
01-11-2002, 10:21 AM
Hi There,

I have a couple of movieclips on the same timeline, each on a seperate layer, but once you load the movieclip on the higher layer, you can never see the one on the lower layer. How can I get it so when I press a button, the movieclip will be brought to the front no matter what layer it is on. Or so that the clip that is on the mainstage disappears before the other clip plays?

Cheers

Barry

jimburton
01-11-2002, 10:33 AM
You can swap the depths of the clips by going

clip1.swapDepths(clip2);

That method takes either the name of a clip or the number of the new level as the arg, so if you want your clip to rise above all clips use

clip1.swapDepths(999 or some high number);

or if you want one of them to disappear temporarily try

clip._visible = false;

barry_sheen
01-11-2002, 11:05 AM
Sorry, I'm a bit new to this, could you tell me where I would put this script?

Cheers

Barry

jimburton
01-11-2002, 11:15 AM
Put the code within some sort of event handler - the simplest example of which would be a button with the code:

on(release) {
clip1.swapDepths(clip2);
clip1.play();
}

When the user clicks the button this code will swap the depths of clip1 and clip2 then play clip1.

This will only work if clip2 is on the layer that you want clip1 to occupy. As I put in last message, it may be better to use an integer for the clip level, then keep incrementing it.