我正在制作一本具有翻页效果的书(直到现在我才让它翻了正确的页面),并且我的索引有问题,因为我翻的页面不会停留在其他页面之上。
我尝试编写 setChildIndex(cont, this.numChildren -1) 但它不起作用!
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);
}