Skip to main content
March 12, 2009
Question

Layers: "bring to front"

  • March 12, 2009
  • 1 reply
  • 448 views
I have a wipe transition of a photo, and underneath that, another photo. So that when the MC is run, what the viewer sees is the underlying scene photo progressively (but quickly) being wiped over by the gradual revelation of a another pict.

Now I want to programmatically move the underlying ("wiped over") layer to the top.

The underlying scene photo occupies the lower layer. I've tried turning the wipe collection of mask and photo for one layer into one symbol, and the other pict scene into another symbol. But for the life of me I don't understand how the code for each goes into the layer tree. Or whether scoping out the symbols as I've postulated is even the right way to proceed.

Thanks for any help.

The board doesn't allow for the ability to post the (f-) file, so there's no way I can ask if anyone can show me how to weave the code into the Timeline area.

Also I'd like to direct the program to bring the lower layer to the top under certain conditions. There are no examples anywhere for how to programmatically do this for CS4. There was a CS3 way to do like this (this is a mouse rollover sample):

on(rollOver)
{
this.swapDepths(1000);
this._x = 100;
this._y = 100;
}

...but in CS4 they've turned this simple directive into something out of the space program. I'm not enthusiastic about buying this software if Adobe makes what's already a very difficult-to-learn API absolutely _unusable_ by failing to provide examples for just about anything.

I really dislike Flash.
This topic has been closed for replies.

1 reply

Participating Frequently
March 13, 2009
if u wanna set depth of movieclip to top u can use:
setChildIndex(a_mc,this.numChildren-1)

if you want to do it on rollover,lets say u have 2 movieclips a_mc,b_mc (instance names)
than:
a_mc.addEventListener(MouseEvent.MOUSE_OVER,onMouseOver,false,0,true)
b_mc.addEventListener(MouseEvent.MOUSE_OVER,onMouseOver,false,0,true)
function onMouseOver(e:MouseEvent)
{
setChildIndex(MovieClip(e.target),this.numChildren-1)
}


March 13, 2009
Armen, thank you very much for replying and for the code that you have generously supplied. I don't understand where or how in either of the button interfaces to put it.

Each has an "Up," "Over," "Down," and "Hit" condition in their respective Timelines. One button is named "pict1" and the other button is named "pict2." (At present, pict1 overlaps pict2.) If I pass over pict2, I'd like for it to be brought forth to topmost in the z-order (and vice versa).

If I start with programming the "Over" event, I don't know what to do. (There's currently a blue square with a small solid round dot in the "Up" column, but the "Over," "Down," and "Hit" columns are blank white.) Where, how does the code go?

Thanks again for any help.