1 Reply Latest reply on Feb 16, 2010 3:43 PM by Jason Szeto

    Passing values to a ProgrammaticSkin

    bentwonk

      I it possible to pass values to a programmatic skin?

       

      I want to customise the apperance of a button based upon a value, for example in the code below (used to create a custom button) I would like the id value to influence how the skin is drawn.

       

          public function CustomButton(idIn:String)
          {
                  super();
                  width=64;
                  height=128;
                  id=idIn;
                 
                  setStyle("upSkin",CustomButtonSkin);
                      setStyle("overSkin", CustomButtonSkin);
                      setStyle("downSkin",CustomButtonSkin);
                 
              }

       

      thanks ben

        • 1. Re: Passing values to a ProgrammaticSkin
          Jason Szeto Level 3

          Ben,

           

          I'd recommend you use styles to pass information to your skin. Any styles set on your CustomButton will be passed down to the CustomButtonSkin.

           

          Also, I'd recommend using a style Type selector instead of using setStyle to set the button skins.

           

          <mx:Style>

           

          CustomButton

          {

           

             skin : ClassReference("CustomButtonSkin");

           

          }

           

          </mx:Style>

           

          Jason