ページめくり効果のある本のスクリプトがあります。しかし、ページを右から左にめくると、白いページの裏はページの表からの反射です。白くするって知ってる?
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.display.Sprite;
import flash.display.Loader;
var cont:DisplayObject;
var cont2:DisplayObject;
var imgLoader:Loader;
var pages:Array = [];
for (var i:int=0; i<=4; i++)
{
imgLoader = new Loader();
imgLoader.contentLoaderInfo.addEventListener(Event.INIT, onLoadJPEG);
imgLoader.load(new URLRequest(""+i+".png"));
}
var imgLoader2:Loader;
imgLoader2 = new Loader();
imgLoader2.contentLoaderInfo.addEventListener(Event.INIT, onLoadSketch);
imgLoader2.load(new URLRequest("voltaatrassketchbook.png"));
function onLoadJPEG(e : Event):void
{
cont = e.target.loader;//obter o loader associado ao LoaderInfo
cont.x = 250;
cont.y = 50;
cont.width = (445 - 100) / 2;
cont.height = (604 - 100) / 2;
addChild(cont);
cont.addEventListener(MouseEvent.MOUSE_UP, FlipPage);
pages.push(cont);
}
function onLoadSketch(e : Event):void
{
cont2 = e.target.loader;//obter o loader associado ao LoaderInfo
cont2.x = 450;
cont2.y = 300;
cont2.width = 181 / 2;
cont2.height = 127 / 2;
addChild(cont2);
cont2.addEventListener(MouseEvent.MOUSE_UP, volta);
}
function FlipPage(e:MouseEvent):void
{
setChildIndex(DisplayObject(e.currentTarget), this.numChildren - 1);
if (e.currentTarget.rotationY == 0)
{
var myTween:Tween = new Tween(e.currentTarget,"rotationY",Regular.easeInOut,0,180,1,true);
}
if (e.currentTarget.rotationY == 180)
{
var myTween:Tween = new Tween(e.currentTarget,"rotationY",Regular.easeInOut,180,0,1,true);
}
}
function volta(e: MouseEvent):void
{
gotoAndStop(1);
for (var i:int = 0; i < pages.length; i++)
{
DisplayObject(pages[i]).visible = false;
}
cont2.visible = false;
}