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

    Flicker when I setStyleName on a button


      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?








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





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





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

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




      The icons

      are these:   locked.png   and unlocked.png.