我正在开发一个缩放方形导航项目(视觉上类似于 Windows Metro,但单击时方形会占据屏幕)。我无法将方块放到顶层(setChildIndex)。这是单击正方形时的代码:
function zoom(event:MouseEvent):void {
// saves location and size of icons
returnto = event.currentTarget;
returntoX = event.currentTarget.x;
returntoY = event.currentTarget.y;
returntoWidth = event.currentTarget.width;
returntoHeight = event.currentTarget.height;
// turn off button behaviours
event.currentTarget.buttonMode = false;
event.currentTarget.alpha = 1;
event.currentTarget.removeEventListener(MouseEvent.MOUSE_OVER, rollover);
event.currentTarget.removeEventListener(MouseEvent.CLICK, zoom);
event.currentTarget.removeEventListener(MouseEvent.ROLL_OUT, rollout);
// put clicked box on top
setChildIndex(returnto, numChildren-1);
// fade out icon decor
TweenLite.to(returnto.decor, .25, {alpha:0});
// make square take over screen, call finished when done
TweenLite.to(returnto, 1, {x:stage.x,y:stage.y, width:stage.stageWidth, height:stage.stageHeight, ease:Expo.easeInOut, onComplete:finished});
}
方块都在舞台上的主影片剪辑(命名为导航)内(所以第一个方块是navigation.sq_1)
我不是 Flash 开发人员,所以我真的在为 AS3 苦苦挣扎。希望这是足以帮助某人的信息。谢谢!小号