all groups > flash actionscript > july 2004 >
You're in the

flash actionscript

group:

Help with Movie Clip Depth!


Help with Movie Clip Depth! DinoJu
7/19/2004 9:01:19 PM
flash actionscript:
I am a novice Flash user who was thrown into the mix to do a Flash project that
involves some Action Script when I know very little about Action Script.
Anyway, below is a script for a runtime movie clip that is overriding all
layers on the screen, even though the layer that contains this script is layer
6 (i.e. there are 5 layers above it) I want to put a button as the topmost
layer, but this movie clip is covering it up.

onClipEvent (enterFrame) {
for(i=0;i<75;i++) {
_root.attachMovie("thinGreyLine", "thinGreyLine"+i,i);
_root["thinGreyLine"+i]._x = 378;
_root["thinGreyLine"+i]._y = i*8 + 2;

I read something about Movie Clip depth affecting the order that a movie
appears (in terms of if objects play on top of or below it in the final movie)
In line 3 of the script below,

_root.attachMovie("thinGreyLine", "thinGreyLine"+i,i);

the final "i" is the movie depth, but I'm not sure how to change this number.
I experimented with several different values but they all made the movie clip
become invisible (i.e the clip didn't work the way it was supposed to). When I
changed the "i" back to "i" again, the clip worked again, but it wass stll
overriding and covering up all layers again.

I hope this is making sense. Thanks for any input anyone can offer

DJ
}
Re: Help with Movie Clip Depth! Jack.
7/19/2004 9:54:42 PM
i don't really understand this part ( not unusual 4 me ;)
[quoted text, click to view]

but my input fwiw ..
don't use - onClipEvent (enterFrame) it re-runs at fps, use onClipEvent (load)
have you tried - _root.attachMovie("thinGreyLine", "thinGreyLine"+i, i-1000);
// ?

you can also swap the stacking orders,
createEmptyMovieClip("bkgrnd_mc",1);
square.swapDepths(bkgrnd_mc);
square.onPress=function(){bkgrnd_mc.unloadMovie(); };

hth

Re: Help with Movie Clip Depth! maulia
7/19/2004 11:51:53 PM
For the depth:
if you put the movieclips, buttons, any arts in the design phase, the depth
will start from
-1048575 upwards (not sure if the number is correct, but let's say it is
correct).

So if you have a dynamic movieclip attached with depth of 3, it will always be
on top (since positive numbers > negative numbers)

Does this help?
Re: Help with Movie Clip Depth! Peter Blumenthal
7/20/2004 11:37:40 AM
Dynamically attached clips will always appear above static clips on the same
timeline. A good workaround in your scenario would be to create an empty
movie clip at the depth you want your lines attached (ie below the button),
give it an instance name (lets say, mcBackground), and attach your lines to
*that* clip. Make sure your empty clip is placed at (0,0). This way they
will stay below your button and the lines will still be in the right place.

Jack's comment about not using the enterFrame handler makes a lot of sense
too. So your code should look something like:

onClipEvent (load) {
for(i=0;i<75;i++) {
_root.mcBackground.attachMovie("thinGreyLine", "thinGreyLine"+i,i);
_root.mcBackground["thinGreyLine"+i]._x = 378;
_root.mcBackground["thinGreyLine"+i]._y = i*8 + 2;
}
}



hth

}p



AddThis Social Bookmark Button