5 Replies Latest reply on May 16, 2009 5:49 AM by Ned Murphy

    Mouse over flicker problem

    Winginsue Level 1

      I'm fairly new to Flash and couldn't find the exact same problem in the forums so here goes.

       

      Flash CS4, Actionscript 3.0

       

      I have a button that I have a mouseover event making another button appear (thus making it look like a color change).  It flickers like crazy with the mouse over.  Any suggestions?

       

      Here's the page (mind you nothing on it but this so far) http://www.forepointusa.com/flash/qbooks/keyfeatures.html

       

       

      Here's the code: (IT is the button you see when you first look at the file.)

       

      import fl.transitions.Tween;
      import fl.transitions.easing.*;

       

      ITBlue.alpha = 0;
      ITBlue.y = 130;

       

      IT.addEventListener(MouseEvent.MOUSE_OVER,showIT);
      IT.addEventListener(MouseEvent.MOUSE_OUT,hideIT);

      function showIT(e:MouseEvent):void {
      ITBlue.y = 172.3;
      ITBlue.alpha = 100;
      }
      function hideIT(e:MouseEvent):void {
      ITBlue.alpha = 0;
      ITBlue.y = 130;
      }

       

      Any suggestions are appreciated.

        • 1. Re: Mouse over flicker problem
          Ned Murphy Adobe Community Professional & MVP

          Is there a reason you don't use the one IT button and just use its Over frame to display it as blue?

           

          Note: in AS3, alpha ranges from 0 to 1 (not 100).

           

          To explain why you have what you have... I am assuming ITBlue is another button.  When you put ITBlue in front of IT you essentially block IT from the mouse, so you ignite IT's rollout function, sending ITBlue back out of the way, which ignites IT's rollover function again, and the cycle goes on unending.  If you hover just on the lower edge of IT, where ITBlue doesn't reach, you'll see it works as desired.

           

          The simplest way around this is to use the one button approach, as there will be no code needed for the rollover and rollout for what you have it doing now.

           

          An alternative would be to place ITBlue in its y = 172 position permanently, change IT to a plain graphic symbol, and use your current code assigned to ITBlue instead of IT, but again, it would be unecessary.

           

          Just some added info... An object that has its alpha set to 0 is still fully mouse interactive... an object that has its visible property set to false is not.

          • 2. Re: Mouse over flicker problem
            Winginsue Level 1

            Hmmm.. I have the blue button positioned above the regular button while it is hidden.  I move it over the regular button while the mouse hovers.  I did a separate button because after creating the button, which is pale blue fill with gray stroke, I didn't think you could change just the fill color.  Is that possible?

             

            I tried putting a keyframe in the over frame for the button and can't do any actionscript.

             

            Thanks for the tip about the alpha.  Still in a major learning phase.

             

            Sue

            • 3. Re: Mouse over flicker problem
              Ned Murphy Adobe Community Professional & MVP

              You cannot (can, but it won't work) and do not need to put code inside the button.  The keyframes inside the button are for visual elements only.  A button on it's own will do what you are trying to do with code and two buttons... a button will animate itself based on mouse interaction.

               

              Create a new button symbol and explore it.  It has 4 frames.  Each frame represents a different interactive state.  Draw something colored differently in each frame and then play your movie and see what happens when you use your mouse with it.

               

              Note the fourth frame defines the Hit area, which is not a visual element, but is used to defined where the button starts to interact with a nouse.  So you could make something of a larger size in the frame if your other button visuals happen to be small... works well for text buttons as well.  Another feature of the Hit frame is that it can be used to create invisible buttons... if you only place something in the hit frame, the button is invisible when played but fully interactive.

              • 4. Re: Mouse over flicker problem
                Winginsue Level 1

                Ned,

                 

                Thank you thank you thank you.  I didn't realize I could do what you described as far as changes.  You helped me immensly.  Thank you for your paitience.

                 

                Suzette

                • 5. Re: Mouse over flicker problem
                  Ned Murphy Adobe Community Professional & MVP

                  You're welcome, Suzette