button test

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
					   xmlns:s="library://ns.adobe.com/flex/spark" 
					   xmlns:mx="library://ns.adobe.com/flex/mx" width="480" height="320">
	<fx:Script>
		<![CDATA[
			import assets.a;
			import assets.b;
			import assets.c;
			import assets.d;
			
			import mx.events.FlexEvent;
			
			protected function myBtn_creationCompleteHandler(event:FlexEvent):void
			{
				myBtn.source = assets.a;			
			}
			
		]]>

	</fx:Script>
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:Image id="myBtn" x="10" y="10" mask="{maskCanvas}" styleName="" creationComplete="myBtn_creationCompleteHandler(event)" >
		<s:filters>
			<s:DropShadowFilter alpha="0.5"/>
		</s:filters>
	</s:Image>
	<mx:Canvas id="maskCanvas" x="10" y="10" width="109" height="38" backgroundColor="#ff0000" cornerRadius="10" borderStyle="solid"/>
</s:WindowedApplication>

 asset.a:

<?xml version="1.0" encoding="utf-8" ?>
<Graphic version="2.0" viewHeight="37.8721" viewWidth="108.974" ai:appVersion="16.0.3.691" ATE:version="1.0.0" flm:version="1.0.0" d:using="" xmlns="http://ns.adobe.com/fxg/2008" xmlns:ATE="http://ns.adobe.com/ate/2009" xmlns:ai="http://ns.adobe.com/ai/2009" xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:flm="http://ns.adobe.com/flame/2008">
  <Library/>
  <Group blendMode="normal" d:layerType="page" d:pageHeight="37.872" d:pageWidth="108.974" d:type="layer" d:userLabel="Artboard 1">
    <Group d:type="layer" d:userLabel="Layer 1">
      <Rect x="-0.106445" y="0.12793" width="109.081" height="37.7441" radiusX="15.5993" radiusY="18.8705" ai:seqID="1">
        <fill>
          <LinearGradient x="54.5405" y="37.7441" scaleX="37.7894" rotation="270">
            <GradientEntry ratio="0" color="#E5E5E5"/>
            <GradientEntry ratio="1" color="#BDBDBD"/>
          </LinearGradient>
        </fill>
      </Rect>
      <Group x="6.50391" y="5.08203" ai:seqID="2" flm:knockout="false">
        <Path x="0.146484" y="0.146484" winding="nonZero" ai:seqID="3" data="M13.772 27.543C6.17822 27.543 0 21.3652 0 13.7715 0 6.17773 6.17822 0 13.772 0L81.7949 0C89.3887 0 95.5664 6.17773 95.5664 13.7715 95.5664 21.3652 89.3887 27.543 81.7949 27.543L13.772 27.543Z">
          <fill>
            <LinearGradient x="47.7832" y="27.543" scaleX="27.576" rotation="270">
              <GradientEntry ratio="0" color="#F2F2F2"/>
              <GradientEntry ratio="1" color="#FFFFFF"/>
            </LinearGradient>
          </fill>
        </Path>
        <Path winding="nonZero" ai:seqID="4" data="M81.9414 0.292969C89.4668 0.292969 95.5664 6.3916 95.5664 13.918 95.5664 21.4414 89.4668 27.543 81.9414 27.543L13.9185 27.543C6.39307 27.543 0.292969 21.4414 0.292969 13.918 0.292969 6.3916 6.39307 0.292969 13.9185 0.292969L81.9414 0.292969M81.9414
 0 13.9185 0C6.24365 0 0 6.24316 0 13.918 0 21.5928 6.24365 27.8359 13.9185 27.8359L81.9414 27.8359C89.6157 27.8359 95.8594 21.5928 95.8594 13.918 95.8594 6.24316 89.6157 0 81.9414 0L81.9414 0Z">
          <fill>
            <SolidColor color="#989898"/>
          </fill>
        </Path>
      </Group>
      <Group x="21.5703" y="15.2266" ai:seqID="5" flm:knockout="false">
        <Path y="0.519531" winding="nonZero" ai:seqID="6" data="M0.0498047 0 1.94873 0C3.07813 0 4.22754 0.509766 4.22754 1.97852 4.22754 3.46875 3.17822 3.97852 2.04883 3.97852 1.46924 3.97852 0.919434 3.82813 0.789551 3.39844L0.839355 3.79883 0.839355 6.69727 0.789551 6.74609 0.0498047 6.74609 0 6.69727
 0 0.0302734 0.0498047 0ZM0.839355 0.799805 0.839355 3.0293C0.929688 3.07813 1.07959 3.17871 1.93896 3.17871 2.65869 3.17871 3.38818 2.85938 3.38818 1.97852 3.38818 1.09961 2.65869 0.799805 1.93896 0.799805L0.839355 0.799805Z">
          <fill>
            <SolidColor color="#6B6C6C"/>
          </fill>
        </Path>
        <Path x="5.23047" y="2.2793" winding="nonZero" ai:seqID="7" data="M1.85889 4.38672C2.12842 4.38672 2.87842 4.10742 2.87842 4.10742L2.87842 0.160156 2.92822 0.0996094 3.62793 0 3.67773 0.0390625 3.67773 4.00781 3.92773 4.88672 3.87744 4.94727 3.26807 5.03711 3.20801 4.99609 2.91797 4.27734C2.79834 4.64648 2.42822
 5.10742 1.52881 5.10742 0.639648 5.10742 0 4.49707 0 3.34766L0 0.160156 0.0498047 0.0996094 0.749512 0 0.799316 0.0390625 0.799316 3.17773C0.799316 4.05664 1.28906 4.38672 1.85889 4.38672Z">
          <fill>
            <SolidColor color="#6B6C6C"/>
          </fill>
        </Path>
        <Path x="10.25" y="2.20898" winding="nonZero" ai:seqID="8" data="M0.459961 4.11719C0.669922 4.29688 1.18945 4.45703 1.49951 4.45703 2.01904 4.45703 2.50879 4.29688 2.50879 3.67773 2.50879 2.6582 0.0400391 3.20801 0.0400391 1.46875 0.0400391 0.439453 0.939453 0 1.8291 0 2.28906 0 2.72852 0.119141 3.11865 0.389648
L3.13867 0.458984 2.74854 0.989258 2.67871 0.989258C2.45898 0.839844 2.12891 0.719727 1.84912 0.719727 1.25977 0.719727 0.839844 1 0.839844 1.46875 0.839844 2.57813 3.30859 1.91895 3.30859 3.67773 3.30859 4.83789 2.479 5.17773 1.5293 5.17773 0.949707
 5.17773 0.390137 5.00781 0.0102539 4.7168L0 4.65723 0.379883 4.12695 0.459961 4.11719Z">
          <fill>
            <SolidColor color="#6B6C6C"/>
          </fill>
        </Path>
        <Path x="14.8203" winding="nonZero" ai:seqID="9" data="M0.749512 2.98828C0.829102 2.80859 1.12891 2.20898 2.13867 2.20898 3.01807 2.20898 3.67773 2.79883 3.67773 3.9375L3.67773 7.2168 3.62793 7.26563 2.92822 7.26563 2.87793 7.2168 2.87793 4.09766C2.87793 3.23828 2.38867 2.92871 1.79883 2.92871 1.5791
 2.92871 0.979004 3.1084 0.799316 3.1582L0.799316 7.2168 0.749512 7.26563 0.0498047 7.26563 0 7.2168 0 0.160156 0.0498047 0.0996094 0.749512 0 0.799316 0.0400391 0.799316 2.54883 0.749512 2.98828Z">
          <fill>
            <SolidColor color="#6B6C6C"/>
          </fill>
        </Path>
        <Path x="22.2397" y="1.17969" winding="nonZero" ai:seqID="10" data="M0.629883 1.14844 0.719727 0.139648 0.769531 0.0800781 1.33936 0 1.38916 0.0390625 1.38916 1.14844 3.04834 1.14844 3.09863 1.19922 2.90869 1.81836 2.83838 1.86914 1.38916 1.86914 1.38916 4.27734C1.38916 4.95703 1.71924 5.4668 2.26904 5.4668 2.64893
 5.4668 3.0083 5.15625 3.0083 5.15625L3.07861 5.16699 3.38818 5.73633 3.36816 5.80664C3.03857 6.03711 2.64893 6.20703 2.19873 6.20703 1.28955 6.20703 0.589844 5.58691 0.589844 4.33789L0.589844 1.86914 0.050293 1.86914 0 1.81836 0 1.19922 0.050293
 1.14844 0.629883 1.14844Z">
          <fill>
            <SolidColor color="#6B6C6C"/>
          </fill>
        </Path>
        <Path x="26.4893" winding="nonZero" ai:seqID="11" data="M0.75 2.98828C0.82959 2.80859 1.12939 2.20898 2.13916 2.20898 3.01855 2.20898 3.67822 2.79883 3.67822 3.9375L3.67822 7.2168 3.62842 7.26563 2.92871 7.26563 2.87891 7.2168 2.87891 4.09766C2.87891 3.23828 2.38916 2.92871 1.79932 2.92871 1.57959
 2.92871 0.979492 3.1084 0.799805 3.1582L0.799805 7.2168 0.75 7.26563 0.050293 7.26563 0 7.2168 0 0.160156 0.050293 0.0996094 0.75 0 0.799805 0.0400391 0.799805 2.54883 0.75 2.98828Z">
          <fill>
            <SolidColor color="#6B6C6C"/>
          </fill>
        </Path>
        <Path x="31.5796" y="2.20898" winding="nonZero" ai:seqID="12" data="M3.0083 3.92773 3.07813 3.9082 3.67773 4.11719 3.70752 4.17773C3.46777 4.81738 2.80811 5.17773 1.9585 5.17773 0.729492 5.17773 0 4.58789 0 3.44824L0 1.76953C0 0.649414 0.739258 0 1.86865 0 3.14795 0 3.57764 0.779297 3.57764 1.47852 3.57764 2.50781
 2.88818 2.94824 1.96875 2.94824 0.919434 2.94824 0.749512 2.36914 0.749512 2.36914L0.799316 2.75781 0.799316 3.27832C0.799316 4.04785 1.23926 4.45703 1.91895 4.45703 2.51855 4.45703 2.81836 4.25781 3.0083 3.92773ZM0.799316 1.87891 0.799316 2.05859
C0.969238 2.18848 1.4292 2.21875 1.84863 2.21875 2.31836 2.21875 2.77832 2.05859 2.77832 1.43945 2.77832 1.08984 2.52832 0.729492 1.83887 0.729492 1.15918 0.729492 0.799316 1.10938 0.799316 1.87891Z">
          <fill>
            <SolidColor color="#6B6C6C"/>
          </fill>
        </Path>
        <Path x="39.209" winding="nonZero" ai:seqID="13" data="M0 0.160156 0.0498047 0.0996094 0.749512 0 0.799316 0.0400391 0.799316 2.54883 0.749512 2.98828C0.829102 2.80859 1.12891 2.20898 2.13867 2.20898 3.01807 2.20898 3.67773 2.79883 3.67773 3.95801L3.67773 5.65723C3.67773 6.77637 2.88818 7.38672 1.85889
 7.38672 1.24902 7.38672 0.689453 7.11621 0.689453 7.11621L0.0498047 7.20605 0 7.15625 0 0.160156ZM0.799316 6.48633C0.799316 6.48633 1.2793 6.66602 1.77881 6.66602 2.43848 6.66602 2.87793 6.25684 2.87793 5.4873L2.87793 4.09766C2.87793 3.23828
 2.38867 2.92871 1.79883 2.92871 1.5791 2.92871 0.979004 3.1084 0.799316 3.1582L0.799316 6.48633Z">
          <fill>
            <SolidColor color="#6B6C6C"/>
          </fill>
        </Path>
        <Path x="44.2891" y="2.2793" winding="nonZero" ai:seqID="14" data="M1.8584 4.38672C2.12793 4.38672 2.87793 4.10742 2.87793 4.10742L2.87793 0.160156 2.92773 0.0996094 3.62744 0 3.67725 0.0390625 3.67725 4.00781 3.92725 4.88672 3.87695 4.94727 3.26758 5.03711 3.20752 4.99609 2.91748 4.27734C2.79785 4.64648 2.42773
 5.10742 1.52832 5.10742 0.639648 5.10742 0 4.49707 0 3.34766L0 0.160156 0.0498047 0.0996094 0.749512 0 0.799316 0.0390625 0.799316 3.17773C0.799316 4.05664 1.28857 4.38672 1.8584 4.38672Z">
          <fill>
            <SolidColor color="#6B6C6C"/>
          </fill>
        </Path>
        <Path x="49.0283" y="1.17969" winding="nonZero" ai:seqID="15" data="M0.629883 1.14844 0.719727 0.139648 0.769531 0.0800781 1.33936 0 1.38916 0.0390625 1.38916 1.14844 3.04834 1.14844 3.09863 1.19922 2.90869 1.81836 2.83838 1.86914 1.38916 1.86914 1.38916 4.27734C1.38916 4.95703 1.71924 5.4668 2.26904 5.4668 2.64893
 5.4668 3.0083 5.15625 3.0083 5.15625L3.07861 5.16699 3.38818 5.73633 3.36816 5.80664C3.03857 6.03711 2.64893 6.20703 2.19873 6.20703 1.28955 6.20703 0.589844 5.58691 0.589844 4.33789L0.589844 1.86914 0.050293 1.86914 0 1.81836 0 1.19922 0.050293
 1.14844 0.629883 1.14844Z">
          <fill>
            <SolidColor color="#6B6C6C"/>
          </fill>
        </Path>
        <Path x="52.6982" y="1.17969" winding="nonZero" ai:seqID="16" data="M0.629883 1.14844 0.719727 0.139648 0.769531 0.0800781 1.33936 0 1.38916 0.0390625 1.38916 1.14844 3.04834 1.14844 3.09863 1.19922 2.90869 1.81836 2.83838 1.86914 1.38916 1.86914 1.38916 4.27734C1.38916 4.95703 1.71924 5.4668 2.26904 5.4668 2.64893
 5.4668 3.0083 5.15625 3.0083 5.15625L3.07861 5.16699 3.38818 5.73633 3.36816 5.80664C3.03857 6.03711 2.64893 6.20703 2.19873 6.20703 1.28955 6.20703 0.589844 5.58691 0.589844 4.33789L0.589844 1.86914 0.050293 1.86914 0 1.81836 0 1.19922 0.050293
 1.14844 0.629883 1.14844Z">
          <fill>
            <SolidColor color="#6B6C6C"/>
          </fill>
        </Path>
        <Path x="56.7681" y="2.20898" winding="nonZero" ai:seqID="17" data="M0 3.44824 0 1.72852C0 0.609375 0.819336 0 1.91895 0 3.01855 0 3.83789 0.609375 3.83789 1.72852L3.83789 3.44824C3.83789 4.56738 3.01855 5.17773 1.91895 5.17773 0.819336 5.17773 0 4.56738 0 3.44824ZM3.03857 3.27832 3.03857 1.88867C3.03857 1.11914
 2.61865 0.719727 1.91895 0.719727 1.19922 0.719727 0.799805 1.11914 0.799805 1.88867L0.799805 3.27832C0.799805 4.04785 1.19922 4.45703 1.91895 4.45703 2.61865 4.45703 3.03857 4.04785 3.03857 3.27832Z">
          <fill>
            <SolidColor color="#6B6C6C"/>
          </fill>
        </Path>
        <Path x="61.8281" y="2.20898" winding="nonZero" ai:seqID="18" data="M3.8877 5.05664 3.18848 5.05664 3.13818 5.00781 3.13818 1.88867C3.13818 1.0293 2.63867 0.719727 2.06885 0.719727 1.84912 0.719727 1.22949 0.899414 1.04932 0.949219L1.04932 5.00781 0.999512 5.05664 0.299805 5.05664 0.25 5.00781 0.25 1.15918 0 0.219727
 0.0498047 0.160156 0.659668 0.0703125 0.719727 0.109375 0.999512 0.80957C1.03955 0.679688 1.3291 0 2.39893 0 3.27832 0 3.93799 0.589844 3.93799 1.72852L3.93799 5.00781 3.8877 5.05664Z">
          <fill>
            <SolidColor color="#6B6C6C"/>
          </fill>
        </Path>
      </Group>
      <Rect width="108.974" height="38" ai:seqID="19" d:userLabel="<Slice>"/>
    </Group>
  </Group>
  <Private/>
</Graphic>

 css:

    <fx:Style>
		@namespace s "library://ns.adobe.com/flex/spark";
		@namespace mx "library://ns.adobe.com/flex/mx";
		.aa{
			color:#58ad6e;
			fontSize:18;
			fontWeight:bold;
			icon:Embed(source="assets/bb.jpg");
		}
	</fx:Style>
	<s:Button id="myBtn" x="10" y="10" width="109" height="38" label="dajiahao" buttonMode="true" styleName="aa"/>
原文地址:https://www.cnblogs.com/houdinime/p/2942693.html