Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-23578

Allow developers to define a default skinClass in the metadata of a custom component

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Later
    • Affects Version/s: Adobe Flex SDK 4.0 (Release)
    • Fix Version/s: None
    • Component/s: Styles
    • Labels:
      None
    • Environment:
      Language Found: English

      Description

      In Flex 3 its common to build a custom component and have it used by people like this:

      <custom:MyCustomComponent />

      In Flex 4 when you build a custom component you might have two classes:

      MyCustomComponent
      MyCustomComponentSkin

      Ideally I would like to be able to distribute these classes to people and have them only need to write:

      <custom:MyCustomComponent />

      rather than needing to include the skinClass:

      <custom:MyCustomComponent skinClass="MyCustomComponentSkin" />

      We currently assume that custom components in Flex 4 will be packaged up in a SWC where a default skinClass can easily be set in defaults.css in the SWC.

      But if you are distributing a custom component that isn't wrapped in a SWC there is no way to define a default skinClass. This is a very common case for people blogging, teaching, and giving presentations about Flex. Most of the time the source code isn't in a SWC.

      Currently bloggers have two options:

      1. Tell people to use the full <custom:MyCustomComponent skinClass="MyCustomComponentSkin" /> tag, which is not as nice and clean as it was in Flex 3.
      2. Set the skinClass in the class constructor which will allow for the clean <custom:MyCustomComponent /> tag

      The downside to #2 is the skinClass can no longer be overridden via CSS by the user since the constructor takes precedence.

      I would like to see some way of defining a default skinClass that is treated with the same precedence as setting it in a default.css file, but inline in the MyCustomComponent.as class.

      Ideally a metadata tag like [DefaultSkin(MyCustomComponentSkin)] or something.

      Attached is a Builder project that demonstrates the current functionality.

        Attachments

          Activity

            People

            • Assignee:
              adobejira Adobe JIRA
              Reporter:
              adobejira Adobe JIRA
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: