<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Style> Application{ fontSize:12; backgroundColor:#AEB4E6; } .btn{ overSkin:Embed("skin/btn_over.gif"); /*在style中嵌入图片*/ upSkin:Embed("skin/btn_up.gif"); downSkin:Embed("skin/btn_down.gif"); } .linkBtn{ overSkin:Embed("skin/btn_over.gif"); upSkin:Embed("skin/btn_up.gif"); } </mx:Style> <mx:Script> <![CDATA[ [Embed(source="skin/btn_up.gif")] [Bindable] private var myImg:Class; ]]> </mx:Script> <mx:Button x="33" y="25" label="修改后的按钮" styleName="btn"/> <mx:Button x="33" y="66" label="修改前的按钮"/> <mx:LinkButton x="33" y="178" label="修改后的linkButton" styleName="linkBtn"/> <mx:LinkButton x="33" y="253" label="没有修改的LinkButton"/> <mx:Button x="33" y="113" label="在MXML中嵌入图片" upSkin="@Embed(source='skin/btn_over.gif')"/> <mx:Button x="370" y="26" label="在ActionScript中嵌入图片元素" upSkin="{myImg}"/> <!-- 在MXML中,upSkin="@Embed(source='skin/btn_over.gif')"如此添加图片 --> <!-- 在CSS和MXML中嵌入图片时,Flex编译器自动将图片转化为可视化对象类型,成为mx.core.BitmapAsset的子类。当使用ActionScript嵌入图片时,还可以制定这个对象的名称,用来代替嵌入的图片 --></mx:Application>