
23.09.2006, 18:12
|
|
Регистрация: Jul 2006
Сообщений: 141
|
Цитата:
|
Сообщение от Nirth
 Код:
function bringToFront(target:MovieClip, swap:Boolean):Void
{
var depth:Number = target.getDepth();
for (var mc in target._parent)
{
var movie:MovieClip = target._parent[mc];
if (movie instanceof MovieClip ||
movie instanceof TextFiled ||
movie instanceof Button)
{
depth = Math.max(depth, movie.getDepth());
trace(movie+":"+depth);
}
}
if (!swap)
{
depth++;
}
target.swapDepths(depth);
}
function createBox(x:Number, y:Number):MovieClip
{
var depth:Number = getNextHighestDepth();
var mc:MovieClip = createEmptyMovieClip("mc"+depth, depth);
mc.lineStyle(4, 0xFF0000);
mc.beginFill(0xff6600);
mc.moveTo(0, 0);
mc.lineTo(100, 0);
mc.lineTo(100, 100);
mc.lineTo(0, 100);
mc.lineTo(0, 0);
mc.endFill();
mc._x = x;
mc._y = y;
mc.onRelease = function():Void {
bringToFront(mc, true);
};
return mc;
}
createBox(20, 20);
createBox(40, 40);
createBox(60, 60);
|
зачем это писать если можно сделать просто
 Код:
mx.behaviors.DepthControl.bringToFront(_root.kartinka);
а?
|