Skip navigation
Currently Being Moderated

Cannot remove transparency on BitmapImage in Button skin

Apr 20, 2012 8:05 PM

I followed a tutorial on how to add images to buttons by creating a class based on Button and a single skin based on ButtonSkin.mxml, but the images display incorrectly. The lighter the colour in the image, the more transparent it becomes. White is completely transparent and black is opaque. I have tried adjusting blendmodes, alpha, etc, in the skin, css and application. In fact I have spent hours trying to trace anything that might cause this or at least override it, but with no success. It works fine when I run the project for the tutorial (created with an unknown older Flex version), but not in my project. Does anyone know what could cause this or how to stop it?
The tutorial is here:
http://brianackermann.wordpress.com/2010/05/06/flex-4-reusable-icon-bu tton-skins/
It works like this:

 

IconButton.as:
   public class IconButton extends Button
   ...

   [Style(name="iconSource",type="*")]
   [Style(name="iconWidth",type="Number")]
   [Style(name="iconHeight",type="Number")]

   ...  

   public function IconButton()

        {

            super();

        }

 

IconButtonSkin.mxml, based on ButtonSkin.mxml:
    [HostComponent("components.IconButton")]

        ...

        <s:BitmapImage

            id="icon"

            source="{hostComponent.getStyle('iconSource')}"

            width="{hostComponent.getStyle('iconWidth')}"

            height="{hostComponent.getStyle('iconHeight')}"

            bottom="-13"

            alpha="1"/>

 

App.mxml:

    [Bindable][Embed(source="assets/someImage.png")]
    public var someIcon:Class;
    ...

    <components:IconButton
        iconHeight="22"

        iconWidth="100"

        iconSource="{someIcon}"

        skinClass="skins.IconButtonSkin"

        ...

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points