我被困住了。当然除了微小的变化(... page1和... page3)之外它是同样的事情,但它在另一个关键帧中不会再次工作。
停止();
import fl.transitions.Tween;
import fl.transitions.easing.Strong;
import fl.transitions.TweenEvent;
import flash.events.Event;
con_housingpage3.side1_housingpage3.flip.addEventListener(MouseEvent.CLICK,onflip);
con_housingpage3.side2_housingpage3.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_housingpage3,'rotationY',Strong.easeOut,con_housingpage3.rotationY,con_housingpage3.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_housingpage3.rotationY>=90 && con_housingpage3.rotationY<=270) {
con_housingpage3.addChild(con_housingpage3.side2_housingpage3);
con_housingpage3.scaleX=-1;
} else {
con_housingpage3.addChild(con_housingpage3.side1_housingpage3);
con_housingpage3.scaleX=1;
}
if (con_housingpage3.rotationY>=360) {
con_housingpage3.rotationY=0;
}
}
the above code works just fine for that keyframe. Why can't i just duplicate it for another keyframe, like
import fl.transitions.Tween;
import fl.transitions.easing.Strong;
import fl.transitions.TweenEvent;
import flash.events.Event;
con_housingpage1.side1_housingpage1.flip.addEventListener(MouseEvent.CLICK,onflip);
con_housingpage1.side2_housingpage1.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_housingpage1,'rotationY',Strong.easeOut,con_housingpage1.rotationY,con_housingpage1.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_housingpage1.rotationY>=90 && con_housingpage1.rotationY<=270) {
con_housingpage1.addChild(con_housingpage1.side2_housingpage1);
con_housingpage1.scaleX=-1;
} else {
con_housingpage1.addChild(con_housingpage1.side1_housingpage1);
con_housingpage1.scaleX=1;
}
if (con_housingpage1.rotationY>=360) {
con_housingpage1.rotationY=0;
}
}