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

ArgumentError: Error #2015: Invalid BitmapData / when using a spark button skin with state and pictures

    XMLWordPrintableJSON

Details

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

    Description

      Steps to reproduce:
      1.Create a project with the following files:

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

      <s:VGroup>
      <s:Button skinClass="ButtonSkin" height="100" width="100" />
      </s:VGroup>

      </s:Application>

      Skin file:
      <?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"
      alpha.disabled="0.5">

      <!-- host component -->
      <fx:Metadata>
      [HostComponent("spark.components.Button")]
      </fx:Metadata>

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

      <!-- layer 1: fill -->
      <s:Rect height="100%" width="100%">
      <s:fill>
      <s:BitmapFill source="@Embed('Images/icon_archives.png')"
      source.over="@Embed('Images/icon_archives_over.png')" />
      </s:fill>
      </s:Rect>
      <!-- layer 2: text -->
      <s:Label id="labelDisplay" />

      </s:SparkSkin>

      2.Run the application
      3.Mouse over the button and then mouse out

      Actual Results:
      ArgumentError: Error #2015: Invalid BitmapData.
      at flash.display::BitmapData/get transparent()
      at mx.graphics::BitmapFill/set source()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\graphics\BitmapFill.as:632]
      at mx.states::SetProperty/setPropertyValue()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\states\SetProperty.as:454]
      at mx.states::SetProperty/remove()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\states\SetProperty.as:416]
      at mx.core::UIComponent/removeState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:10012]
      at mx.core::UIComponent/commitCurrentState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9794]
      at mx.core::UIComponent/setCurrentState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9701]
      at mx.core::UIComponent/set currentState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:6087]
      at spark.components.supportClasses::SkinnableComponent/commitProperties()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:428]
      at spark.components.supportClasses::ButtonBase/commitProperties()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\supportClasses\ButtonBase.as:735]
      at mx.core::UIComponent/validateProperties()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7772]
      at mx.managers::LayoutManager/validateProperties()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:572]
      at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:730]
      at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]

      Expected Results:
      Back to original image

      Workaround (if any):
      Define the source for EACH state. So instead of this:

      <!-- layer 1: fill -->
      <s:Rect height="100%" width="100%">
      <s:fill>
      <s:BitmapFill source="@Embed('fx_appicon-tn.gif')"
      source.over="@Embed('fl_player_appicon-tn.gif')" />
      </s:fill>
      </s:Rect>

      Do this:

      <!-- layer 1: fill -->
      <s:Rect height="100%" width="100%">
      <s:fill>
      <s:BitmapFill source.up="@Embed('fx_appicon-tn.gif')"
      source.over="@Embed('fl_player_appicon-tn.gif')"
      source.down="@Embed('fx_appicon-tn.gif')"
      source.disabled="@Embed('fx_appicon-tn.gif')" />
      </s:fill>
      </s:Rect>

      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: