Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can also define a ButtonImageSkin for the default spark.components.Button component, for example in the imageskins package:</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("spark.components.Button")] &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 source="{getStyle('backgroundImage')}"/&gt; &lt;/s:SparkButtonSkin&gt; </code></pre> <p>Simply define a style on the skin class itself, and bind the source of the image to it. Now, you can control the actual images using CSS pseudo selectors:</p> <pre><code>@namespace imageskins "imageskins.*"; s|Button { skinClass: ClassReference("imageskins.ButtonImageSkin"); } imageskins|ButtonImageSkin:up { backgroundImage: Embed(source="assets/images/button-up.png"); } imageskins|ButtonImageSkin:down { backgroundImage: Embed(source="assets/images/button-down.png"); } imageskins|ButtonImageSkin:over { backgroundImage: Embed(source="assets/images/button-over.png"); } imageskins|ButtonImageSkin:disabled { backgroundImage: Embed(source="assets/images/button-disabled.png"); } </code></pre> <p>This way you can obtain the result with more flexible CSS based rules. I ended up creating a set of image-based Spark skins for various Flex components: FXG is way more powerful, but sometimes working with scale9 images is simply the quickest way to obtain the desired result.</p> <p>Side note: if you put your skin classes and your CSS file (with any name) in a Flex Library Project, and compile your client project with the -theme option, Flex will automatically apply the CSS.. useful when creating a set of skin along with the CSS that associate them with their host components.</p>
    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.
    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