0 Replies Latest reply on Jan 31, 2008 2:43 PM by UKFlexNewb

    Dynamic skining - what is the best way?

      Hi all, im relatively new to flex and AS.

      I needed a dymaic skin of sort for a project im working; ie; the button could "fill" in increments of ten; to give the effect it is filling up.

      To achieve this; I have

      1)Created a custom button compenet with a property "fill level" which is an int,
      2)On event foo I increment this property -
      3)In the programtic skin for the button I cast the custom button using CustomButton(this.parent); read is current fill level and use this as the Y value for my gradient fill.
      4)After two; ie button.fillUp() i do button.styleName = "" then button styleName = "fooStyle". Foo stlye is a CSS class which relates the buttons upskin to the programtic actionscript skin. Before and after a fillup or down it is "fooStyle" but i have to do this code to refresh it.

      Two questions really:

      1)Is my whole approach the right way to go about this (i dont want 10 differnt skins for each fill state)
      2)Is there a cleaner way of refeshing the button?

      Hope this makes sense!