Я застрял. Это то же самое, за исключением, конечно, незначительных изменений (... 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;
}
}