PDA

View Full Version : Bringing objects to top...



FrozenToast
January 16th, 2004, 05:19 PM
I have 3 layers

3
2
1

the bottom layer is my bground (1)

layer 2 is some stars with actionscript to make them move

and layer 3 is on top and is a black tree

When i test the movie the stars appear ontop of the tree.

How can I bring the stars back, or bring the tree to the top?

Thanks in advance
Andy

edit: here's the code for layer 2

onClipEvent (load) {
// movie width/height
height = 200;
width = 500;
// ------------------------//
// makes everything random //
// ------------------------//
this._x = Math.round(Math.random()*width);
this._y = Math.round(Math.random()*height);
var temp = this._alpha=Math.random()*100;
this._xscale = this._yscale=temp;
// setting initiaion position
cx = this._x;
cy = this._y;
}
onClipEvent (enterFrame) {
// causes the object to be offset
this._x = cx+(1+Math.random()*5);
this._y = cy+(1+Math.random()*5);
}

brian monkey
January 20th, 2004, 09:01 PM
I think you should just have layer 2 and 3 trade places.

Michael Chen
January 22nd, 2004, 08:38 PM
Use the swapDepths function in actionscript if the tree and star are movie clip objects.

i.e. if you called the star "starObj"
and you called the tree "treeObj"

starObj.swapDepths(1000); // 1000 is just a huge number so that the star becomes higher in level then treeObj.

And vice versa for the tree object. You see what I mean?