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

[SkinPart] Metadata above private variable should result in compile error (currently results in runtime error)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Adobe Flex SDK Previous
    • Adobe Flex SDK Previous
    • None
    • Affected OS(s): All OS Platforms
      Affected OS(s): All OS Platforms
      Language Found: English

    Description

      Steps to reproduce:

      // IconButton.mxml
      <?xml version="1.0" encoding="utf-8"?>
      <s:Button xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/halo"
      skinClass="IconButtonSkin">

      <fx:Script>
      <![CDATA[
      import spark.primitives.BitmapImage;
      [SkinPart]
      private var icon:BitmapImage;
      ]]
      >
      </fx:Script>
      </s:Button>

      // IconButtonSkin.mxml
      <?xml version="1.0" encoding="utf-8"?>
      <s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      minWidth="21" minHeight="21"
      alpha.disabled="0.5">

      <!-- host component -->
      <fx:Metadata>
      [HostComponent("IconButton")]
      </fx:Metadata>

      <!-- states -->
      <s:states>
      <s:State name="up" />
      <s:State name="over" />
      <s:State name="down" />
      <s:State name="disabled" />
      </s:states>

      <s:BitmapImage id="icon"
      left="5" verticalCenter="0" top="5" bottom="5" />

      </s:SparkSkin>

      1. Note that the [SkinPart] metadata is above a private variable in IconButton.
      2. Launch the application.

      Actual Results:

      The following runtime error is reported:

      ReferenceError: Error #1056: Cannot create property icon on IconButton.
      at spark.components.supportClasses::SkinnableComponent/findSkinParts()[E:\dev\beta1\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:554]
      at spark.components.supportClasses::SkinnableComponent/attachSkin()[E:\dev\beta1\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:524]
      at spark.components.supportClasses::SkinnableComponent/validateSkinChange()[E:\dev\beta1\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:280]
      at spark.components.supportClasses::SkinnableComponent/createChildren()[E:\dev\beta1\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:250]
      at mx.core::UIComponent/initialize()[E:\dev\beta1\frameworks\projects\framework\src\mx\core\UIComponent.as:6510]

      Expected Results:

      Since the skin part needs to be public to be accessed by the skin, the compiler should throw an error saying [SkinPart] cannot be used for a private variable.

      Workaround (if any):

      Declare the [SkinPart] as public.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: