I'm making a book with a page flipping effect (I only have it flipping the right page until now), and I'm having a problem with the index, because the page that I flip doesnt stay on top of the others.
I tried writing setChildIndex(cont, this.numChildren -1) but it is not working!
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.display.Sprite;
var cont : DisplayObject;
var imgLoader : Loader;
for (var i:int=0; i<=4; i++){
imgLoader = new Loader();
imgLoader.contentLoaderInfo.addEventListener(Event.INIT, onLoadJPEG);
imgLoader.load(new URLRequest(""+i+".png"));
}
function onLoadJPEG (e : Event) : void {
cont = e.target.loader;
cont.x =300;
cont.y =65;
cont.width = 286/2;
cont.height = 406/2;
addChild(cont);
cont.addEventListener(MouseEvent.MOUSE_UP, FlipPage);
}
function FlipPage(e:MouseEvent):void{
setChildIndex(cont, this.numChildren -1);
var myTween:Tween = new Tween(e.currentTarget, "rotationY", Regular.easeInOut,0, 180, 1, true);
}