1 Reply Latest reply on May 3, 2010 11:09 AM by fredrossperry2

    Flicker when I setStyleName on a button

    fredrossperry2

      I have a button where, when it's pushed, in a MouseEvent.CLICK listener,

      I toggle it between two states with different icons, as below.

       

      When I do this, it works, but  get a flicker; for a brief

      moment the icon is not in the center of the button.

       

      I used to do this by setting the "icon" style instead, referencing an

      embedded image.  But I wanted to pull the reference to the icon file

      out into a style.

       

      Is there hope for me?

      thanks

      --------------------------

       

      CSS:

       

           .lockUnlockButtonLocked

           {   

               icon: Embed("assets/locked.png");

           }

       

           .lockUnlockButtonUnlocked

           {   

               icon: Embed("assets/unlocked.png");

           }

       

      AS3:

       

           thisLockButton.setStyle("styleName", "lockUnlockButtonLocked");     or

           thisLockButton.setStyle("styleName", "lockUnlockButtonUnlocked");

       

      Icons:

       

      The icons

      are these:   locked.png   and unlocked.png.