使用行为

来源:互联网 发布:淘宝发布的草稿在哪里 编辑:程序博客网 时间:2024/04/28 04:00

 1、创建一个行为;

2、从不同的组件调用一种效果;

3、创建一个组合效果;

Demo:按钮在点击后变成绿色,然后渐淡最后为浅绿色,表示按钮被点击过;当按钮点击一下,数字就会从模糊逐渐明显,同时向下下降20象素。

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    
<mx:Glow id="buttonGlow" color="0x99FF66" alphaFrom="1.0" alphaTo="0.3" duration="1500"/>
    
<mx:Parallel id="BlurAndMove" target="{myLabel}">
        
<mx:Blur id="numbersBlur"
            blurYFrom
="10.0" blurYTo="0.0"
            blurXFrom
="10.0" blurXTo="0.0"
            duration
="2000"/>    
        
<mx:Move id="numbersMove" yBy="20" duration="2000"/>    
    
</mx:Parallel>

    
<mx:Panel width="459" height="451" x="10" y="10" layout="absolute">
        
<mx:Button id="myButton" label="View" x="40" y="60" width="100" height="100" 
            mouseUpEffect
="{buttonGlow}"
            click
="BlurAndMove.play();myLabel.visible=true;"/>
        
<mx:Label x="151" y="10" id="myLabel" 
            visible
="false"
            text
="1234567890 0987654321" fontSize="20"/>
    
</mx:Panel>
</mx:Application>
原创粉丝点击