Trailer : Adobe flash cs4 tutorial: 3d page flip
Dalam tutorial ini mempelajari cara membuat halaman 3d efek flip menggunakan 3 actionscript dan kelas tween. Efek ini terlihat seperti album flip penutup di ipods baru.
import fl.transitions.Tween;
import fl.transitions.easing.Strong;
import fl.transitions.TweenEvent;
con.sidea.flip.addEventListener(MouseEvent.CLICK,onflip);
con.sideb.flip.addEventListener(MouseEvent.CLICK,onflip);
addEventListener(Event.ENTER_FRAME,loop);
var isStill:Boolean=true;
var arraytween:Array = new Array();
function onflip(e:Event) {
if (isStill) {
arraytween.push(new Tween(con,'rotationY',Strong.easeOut,con.rotationY,con.rotationY+180,1,true));
arraytween[0].addEventListener(TweenEvent.MOTION_FINISH,reset);
isStill=false;
}
}
function reset(e:Event) {
isStill=true;
arraytween=[];
}
function loop(e:Event) {
if (con.rotationY>=90 && con.rotationY<=270) { con.addChild(con.sideb); con.scaleX=-1; } else { con.addChild(con.sidea); con.scaleX=1; } if (con.rotationY>=360) {
con.rotationY=0;
}
}
import fl.transitions.easing.Strong;
import fl.transitions.TweenEvent;
con.sidea.flip.addEventListener(MouseEvent.CLICK,onflip);
con.sideb.flip.addEventListener(MouseEvent.CLICK,onflip);
addEventListener(Event.ENTER_FRAME,loop);
var isStill:Boolean=true;
var arraytween:Array = new Array();
function onflip(e:Event) {
if (isStill) {
arraytween.push(new Tween(con,'rotationY',Strong.easeOut,con.rotationY,con.rotationY+180,1,true));
arraytween[0].addEventListener(TweenEvent.MOTION_FINISH,reset);
isStill=false;
}
}
function reset(e:Event) {
isStill=true;
arraytween=[];
}
function loop(e:Event) {
if (con.rotationY>=90 && con.rotationY<=270) { con.addChild(con.sideb); con.scaleX=-1; } else { con.addChild(con.sidea); con.scaleX=1; } if (con.rotationY>=360) {
con.rotationY=0;
}
}