Flex 淡入淡出的效果

<?xml version="1.0"?> 

<!-- Simple example to demonstrate the Fade effect. --> 

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" height="360" 

     width="436"> 

    <mx:Fade id="fadeOut" duration="1000" alphaFrom="1.0" alphaTo="0.0"/> 

    <mx:Fade id="fadeIn" duration="1000" alphaFrom="0.0" alphaTo="1.0"/> 

 

    <mx:Panel title="Fade Effect Example" width="356" height="310"  

         horizontalAlign="center" layout="absolute"> 

        <mx:Text width="100%" color="blue" fontSize="12" 

            text="使用Fade效果淡入淡出图片"/> 

     

        <mx:Image source="@Embed(source='meinv.jpg')" id="img"  

            visible="true" 

            hideEffect="{fadeOut}" showEffect="{fadeIn}" x="28" y="26"/> 

 

        <mx:Button x="88" y="234" label="显示" fontSize="12"  

            click="img.visible=true"/> 

        <mx:Button x="196" y="234" label="隐藏" fontSize="12"  

            click="img.visible=false"/> 

    </mx:Panel> 

</mx:Application> 

 

 

alphaFrom指定初始透明度alphaTo表示最终透明度,取值范围都是0.0~1.0,0.0 表示透明,1.0 表示完全不透明。

showEffect事件和hideEffect事件分别指显示时的效果事件和隐藏时的效果事件,duration属性表示效果的时间间隔。


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值