Groups | Blog | Home
all groups > flash actionscript > february 2004 >

flash actionscript : Duplicating MovieClip - depth


hritikny
2/14/2004 11:59:13 PM
Hi
I am using duplicateMovieClip as follows
function NewEllipse()
lastEllipse++
duplicateMovieClip("ellipse1_mc", "ellipse1_mc"+lastEllipse, lastEllipse+20)
}
where "ellipse1_mc" is the name from the linkage
I am not sure how to make the duplicated MovieClips to appear at the back (for
instance: level -20000) as the text I ma using is always appearing behind the
duplicated MovieClips. I want to make the text appear always on top of it
Please advise as soon as possible
Take care


Carixpig
2/15/2004 3:53:28 AM
use the swapDepths() fuction on your text mc

onClipEvent(enterFrame)
this.swapDepths(lastEllipse + 20)


This will cause each new ellipse to swap with the text. because swapDepths()
is being called on an enterFrame event, it will loop through and the text will
always replace the last ellipse that appeared on the stage. So your ellipses
will maintain their stacking order, and your text will always be in the level
last Ellipse + 20. Or you could use

onClipEvent(load)
this.swapDepths(200000000)


because you might find the text keeps flashing behind the ellipses, so you
need to put the text in a high level right from the start, so high that you
need 199999999 ellipses before the text falls behind..
AddThis Social Bookmark Button