0 Replies Latest reply on Mar 28, 2010 2:59 PM by thx1138

    Best way to make skins swappable in Flex 4

    thx1138 Level 1

      Hi, I really love the new Flex 4 skinning architecture! Congrats on an amazing design!



      Now that I've been using it for a while I'm trying to figure out a few things.


      If I want to make my whole app skinnable and dynamic at runtime how would I do it?


      For example let's say I have this application:


      <MyApp styleName="applicationStyle" >

              <fx:Style source="assets/styles/default.css"/>



              <s:Button label="feedback" id="feedbackButton"   />

              <s:Button label="contact id="contactButton"   />


              <s:SkinnableContainer id="formContainer" width="100%" left="10" right="10" top="50">


                      <s:TextInput id="nameInput"   />

                      <s:Button label="submit" id="submitButton"   />






      I could then style it with this:



      @namespace s "library://ns.adobe.com/flex/spark";
      @namespace mx "library://ns.adobe.com/flex/mx";


      s|Button#feedbackButton {


      s|Button#contactButton {


      s|SkinnableContainer#formContainer {
          skinClass: ClassReference("com.domain.skins.FormContainerSkin");


      s|TextInput#nameInput {


      s|Button#submitButton {




      If I have a second css file that points to different skins how would I change that dynamically at runtime? Am I getting the right idea here?