3 Replies Latest reply on Sep 8, 2010 9:25 AM by kglad

    ROLL_OVER/ ROLL_OUT flickering

    jreich9484 Level 1

      Sorry for asking a simple question, I am very new to flash.  I am trying to make a menu with buttons that addChild(MC from stage to top of btn) on ROLL_OVER and is removed on ROLL_OUT.  At the moment I can't figure out a way to keep the objects from conflicting.  Also on the ROLL_OVER this.addChild(newFlower) it seems to be triggering newFlower multiple times. here is my code:



      import fl.transitions.Tween;

      import fl.transitions.easing.*;

      import flash.events.MouseEvent;


      var newRooster:rooster_mc = new rooster_mc();


      btn_mc.addEventListener(MouseEvent.ROLL_OVER, rollOverF);

      btn3_mc.addEventListener(MouseEvent.ROLL_OVER, rollOverB);

      btn3_mc.addEventListener(MouseEvent.ROLL_OUT, rollOutB);


      function rollOverF(event:MouseEvent):void{

           var newFlower:flowers_mc = new flowers_mc();


         newFlower.x = 110;

           newFlower.y = 268;




      function rollOverB(event:MouseEvent):void{


           newRooster.x = 120;

           newRooster.y = 480;

         var video2Tween:Tween = new Tween(event.target, "alpha", Strong.easeOut,0,1,1,true);

           var video2W:Tween = new Tween (event.target, "width", Strong.easeOut,173,183,1,true);

           var video2H:Tween = new Tween (event.target, "height", Strong.easeOut,174,184,1,true);




      function rollOutB(event:MouseEvent):void{


           var video2WOut:Tween = new Tween (event.target, "width", Strong.easeOut,183,173,1,true);

           var video2HOut:Tween = new Tween (event.target, "height", Strong.easeOut,184,174,1,true);




      Any help would be greatly appreciated.  Again I am very new to AS so i apologize for any improper wording in my questioning.



        • 1. Re: ROLL_OVER/ ROLL_OUT flickering
          kglad Adobe Community Professional & MVP

          your code is doing exactly what you describe and what you should expect it to do.  what is it you want your code to do?

          • 2. Re: ROLL_OVER/ ROLL_OUT flickering
            jreich9484 Level 1

            When ROLL_OVER btn3_mc I want it to add rooster_mc to the top of btn3_mc (which it is doing), but btn3_mc and rooster_mc start flickering wildly.  I want to stop that.  And when I ROLL_OVER btn_mc I want to play flowers_mc (which it is doing), but it appears to be calling flowers_mc multiple times with no real consistency. I want to just have it come up once at a time.

            • 3. Re: ROLL_OVER/ ROLL_OUT flickering
              kglad Adobe Community Professional & MVP

              you need to rethink your coding.


              when you rollover btn3_mc and add an object the triggers a rollout event (which is what happens when you add rooster_mc above your button) and then your rollout triggers a rollover (which what happens when you remove rooster_mc), you're causing a loop and the resultant rooster_mc flickering.


              and your btn_mc rollover triggers a new flowers_mc with each rollover.  if you don't want that to occur, don't encode that.