0 Replies Latest reply on Aug 24, 2010 11:49 AM by DavidSalahi

    Properties vs. Styles for Setting Visual Appearance of Controls?

    DavidSalahi Level 1

       

      I'm a bit confused by what seems to be a schizophrenic approach to properties and styles within the Flex 4 SDK. In some cases, components have properties that affect their visual appearance while in other cases they use styles. For example, here is a BorderContainer from an example in Adobe's Using Flex 4 docs:

      <s:BorderContainer width="200" height="200"
                                         borderColor="0x000000"
                                    
         borderAlpha="1"
                                     
         cornerRadius="10"
                                     
         borderWeight="1">

      borderColor, borderAlpha, cornerRadius and borderWeight are all styles. However, BorderContainer also has some properties for visual formatting; e.g.,: backgroundFill and borderStroke. The latter property equates to two of the styles: borderColor and borderWeight. But the former, backgroundFill, doesn't appear to have a corresponding style although there is a backgroundImage style.

       

      So, I'm wondering why the SDK has this split personality. But more to the point, I'm wondering if there's some logical explanation. How do I know when to use a style rather than a property? Where should developers look first when seeking to modify the visual appearance of a control?

      David Salahi