3 Replies Latest reply on May 19, 2009 12:53 PM by Ned Murphy

    Small but annoying issue - delay in button action

    qpidity72 Level 1

      Hi,

       

      I'm experiencing an annoying issue with a movie clip button.

       

      The movie clip is linked to a class which adds a rollover and rollout effect.

       

      The issue I'm having is that, even though the button is in frame 1, the button doesn't react to the mouse for some seconds into the movie.

       

      The only thing I can think is that it's the class itself, but I'm not certain.

       

      Here's the class:-

       

      package
          {
              import flash.display.Sprite;
              import flash.events.MouseEvent;
              import caurina.transitions.*;
              import caurina.transitions.properties.*;
              ColorShortcuts.init();
             
             
             
              public class ButtonColourGreys extends Sprite
              {
                 
                 
                  var rolledOver = false;
                 
                  public function ButtonColourGreys()
                  {
                      this.addEventListener(MouseEvent.ROLL_OVER, transColourIn);
                      this.addEventListener(MouseEvent.ROLL_OUT, transColourOut);
                      this.buttonMode = true;
                  }
                 
                  private function transColourIn(event:MouseEvent):void
                  {
                      if(!rolledOver)
                      {
                      Tweener.addTween(this,{_color:0x666666,time:0.4});
                      }
                     
                  }
                 
                  private function transColourOut(event:MouseEvent):void
                  {
                      if(!rolledOver)
                      {
                      Tweener.addTween(this,{_color:0x999999,time:0.4});
                     
                      }
                  }
                 
                 
                 
                 
                 
              }
          }

       

      Could anyone suggest what the problem might be and/or a solution ?

       

      Many thanks

        • 1. Re: Small but annoying issue - delay in button action
          Ned Murphy Adobe Community Professional & MVP

          I'm not familiar with Tweener beyond having it loaded and waiting to start using it someday, so I'm wondering if the problem might be related to it somehow.  I don't think the class should be an issue since that is dealt out in compiling the movie.

           

          In place of the Tweener calls, try simply changing the alpha value of the object and see if it works any faster (this.alpha = 0.5; etc).

          1 person found this helpful
          • 2. Re: Small but annoying issue - delay in button action
            qpidity72 Level 1

            Hi Ned,

             

            Replacing the Tween with a change in the alpha value works much faster - in fact it outputs with the response I would want the Tweener to work. Do you think that this is simply a matter of trade-off ? Or do you think I could still achieve the response I want with a tween ? I would prefer to keep the tween if the performance could be improved.

             

            Thanks again.

            • 3. Re: Small but annoying issue - delay in button action
              Ned Murphy Adobe Community Professional & MVP

              I just suggested that to see if the Tween might be the guilty party, which it appears to be.  I am not familiar with its use at all, but from glancing around a quick Google, it appears to also support a delay property and an easing method property.  So maybe you need to fiddle around with those... make the delay=0 and see if any specific easing method gives you a better response time... maybe your not specifying one could be part of the problem?