0 Replies Latest reply on Jul 20, 2009 5:15 PM by DigitalBiz4U

    Simple Flip of two images flashing

    DigitalBiz4U

      This code works in Flash ide and IE8.  In Firefox and Google chrome after flipping once it just starts to flash.

       

      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;

                }

      }

       

      Thanks, Need your help....