actionscript 3 - Changing levels of nested movieclips in Flash AS 3.0 -
i working on zooming square navigation project (visually windows metro, squares take on screen when clicked on). i'm having trouble getting squares top layer (setchildindex). here code when square clicked on:
function zoom(event:mouseevent):void { // saves location , 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 on 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}); } the squares inside main movieclip (named navigation) on stage (so first square navigation.sq_1)
i not flash developer, i'm struggling as3. enough info help. thanks! s
just try add returnto clip addchild() method:
// put clicked box on top addchild(returnto); display list's default behavior when addchild() put child on top of childs. other children's indexes recounted.
Comments
Post a Comment