Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's a basic image button that's more general:</p> <p>ImageButtonSkin.mxml</p> <pre><code>&lt;s:SparkButtonSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:fb="http://ns.adobe.com/flashbuilder/2009"&gt; &lt;fx:Metadata&gt; [HostComponent("com.instantdelay.flex.commons.ImageSkinnableButton")] &lt;/fx:Metadata&gt; &lt;s:states&gt; &lt;s:State name="up" /&gt; &lt;s:State name="over" /&gt; &lt;s:State name="down" /&gt; &lt;s:State name="disabled" /&gt; &lt;/s:states&gt; &lt;s:BitmapImage id="image" source.up="{getStyle('upImage')}" source.down="{getStyle('downImage')}" source.over="{getStyle('overImage')}" source.disabled="{getStyle('disabledImage')}" /&gt; &lt;/s:SparkButtonSkin&gt; </code></pre> <p>ImageSkinnableButton.as</p> <pre><code>[Style(name="upImage", inherit="no", type="Class")] [Style(name="downImage", inherit="no", type="Class")] [Style(name="overImage", inherit="no", type="Class")] [Style(name="disabledImage", inherit="no", type="Class")] public class ImageSkinnableButton extends Button { public function ImageSkinnableButton() { super(); setStyle("skinClass", ImageButtonSkin); } } </code></pre> <p>Then you can set the images as styles on the button in either CSS (preferred) or in mxml:</p> <pre><code>&lt;commons:ImageSkinnableButton upImage="@Embed('imgs/mainButton_std.png')" overImage="@Embed('imgs/mainButton_over.png')" downImage="@Embed('imgs/mainButton_over.png')" disabledImage="@Embed('imgs/mainButton_std.png')" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload