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

Setting a custom style in a subclass of an MXML component causes the wrong skin to be used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Adobe Flex SDK Previous
    • None
    • MXML Compiler
    • None
    • Affected OS(s): All OS Platforms
      Affected OS(s): All OS Platforms
      Language Found: English

    Description

      Steps to reproduce:
      1. Run attached Flex Desktop Project (FXP)
      2.
      3.

      Actual Results:

      RTE:

      SkinnableComponent.findParts line 726 throws an RTE:

      Error: Required skin part labelDisplay cannot be found.
      at spark.components.supportClasses::SkinnableComponent/findSkinParts()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:726]
      at spark.components.supportClasses::SkinnableComponent/attachSkin()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:701]
      at spark.components.supportClasses::SkinnableComponent/validateSkinChange()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:443]
      at spark.components.supportClasses::SkinnableComponent/createChildren()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:406]
      at spark.components::SkinnableContainer/createChildren()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:879]
      at mx.core::UIComponent/initialize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7624]
      at MyRootComponent/initialize()
      at MyComponent/initialize()
      at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7485]
      at mx.core::UIComponent/addChildAt()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7189]
      at spark.components::Group/addDisplayObjectToDisplayList()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:2037]
      at spark.components::Group/http://www.adobe.com/2006/flex/mx/internal::elementAdded()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1628]
      at spark.components::Group/setMXMLContent()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:633]
      at spark.components::Group/set mxmlContent()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:573]
      at spark.components::SkinnableContainer/set mxmlContent()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:657]
      at spark.components::SkinnableContainer/createDeferredContent()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:1050]
      at spark.components::SkinnableContainer/createContentIfNeeded()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:1078]
      at spark.components::SkinnableContainer/createChildren()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:885]
      at spark.components::Application/createChildren()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Application.as:1480]
      at mx.core::UIComponent/initialize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7624]
      at spark.components::Application/initialize()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Application.as:1334]
      at spark.components::WindowedApplication/initialize()[E:\dev\4.y\frameworks\projects\airspark\src\spark\components\WindowedApplication.as:1834]
      at Repro/initialize()
      at mx.managers.systemClasses::ChildManager/childAdded()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\systemClasses\ChildManager.as:189]
      at mx.managers.systemClasses::ChildManager/initializeTopLevelWindow()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\systemClasses\ChildManager.as:359]
      at mx.managers::SystemManager/initializeTopLevelWindow()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:3063]
      at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::kickOff()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:2849]
      at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::preloader_completeHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:2729]
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.preloaders::Preloader/timerHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:542]
      at flash.utils::Timer/_timerDispatch()
      at flash.utils::Timer/tick()

      I debugged this a little and it looks like the skin object is an instance of SkinnableContainerSkin rather than MyRootComponentSkin.

      Expected Results:

      No RTE, the component should have the right skin. This RTE doesn't happen if the subclass doesn't set myStyle="2"

      Workaround (if any):

      A possible workaround would be to write the root component using ActionScript rather than MXML. There is an example in the attached FXP

      Set the skin on the MyRootComponent using a CSS Style block in your application (or in defaults.css) instead of on the component directly.

      Attachments

        Activity

          People

            Unassigned Unassigned
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: