WEB开发网
开发学院图形图像Flash 积少成多Flash(11) - Flex 3.0 动画效果(effect) 阅读

积少成多Flash(11) - Flex 3.0 动画效果(effect)

 2009-11-28 00:00:00 来源:WEB开发网   
核心提示: 13、Sequence.mxml<?xmlversion="1.0"encoding="utf-8"?><!--对各种effect做串行展示--><mx:Panelxmlns:mx="http://www.adobe

13、Sequence.mxml

<?xml version="1.0" encoding="utf-8"?>
<!--
    对各种 effect 做串行展示
-->
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" horizontalAlign="center" width="400" height="300"
    title="Effect - Sequence (效果串行), AnimateProperty, Pause">
    
    <mx:Label text="顺便说明 AnimateProperty, Pause"/>
    
    <mx:Sequence id="sequence">
         <mx:AnimateProperty property="scaleX" fromValue="1" toValue="3" duration="300" />
         <mx:Pause duration="2000"/>
        <mx:AnimateProperty property="scaleX" fromValue="3" toValue="1" duration="1000" />  
    </mx:Sequence>
    
    <mx:Image source="@Embed('images/logo.png')"
        width="48" height="48"
        scaleX="1" scaleY="1"
        mouseDownEffect="{sequence}"
     />
     
</mx:Panel>

14、TweenEffect.mxml

<?xml version="1.0" encoding="utf-8"?>
<!--
    演示 TweenEffect (此类是大部分 effect 的基类) 
-->
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300"
    title="TweenEffect 的介绍(它是部分 effect 的基类)">
    
    <mx:Script>
        <![CDATA[
        
            import mx.events.TweenEvent;
            
            private function tweenStartHandler(e:TweenEvent):void
            {
                txtMsg.text += "补间效果开始\r";
            }
            
            private function tweenEndHandler(e:TweenEvent):void
            {
                txtMsg.text += "补间效果结束\r";
                lblUpdate.text = "宽度: " + image.width;
            }
            
            private function tweenUpdateHandler(e:TweenEvent):void
            {
                lblUpdate.text = "宽度: " + image.width;
            }
            
        ]]>
    </mx:Script>
    
    <mx:Resize id="resizeUp" target="{image}" widthTo="180" heightTo="180" duration="5000"
        tweenStart="tweenStartHandler(event)"
        tweenEnd="tweenEndHandler(event)"
        tweenUpdate="tweenUpdateHandler(event)"
    />
    <mx:Resize id="resizeDown" target="{image}" widthTo="48" heightTo="48" />
    
    <mx:Image id="image" source="@Embed('images/logo.png')" 
        x="24" y="24" width="48" height="48"
     />
    <mx:Text x="264" y="36" width="106" height="178" id="txtMsg"/>
    <mx:Label x="264" y="10" id="lblUpdate"/>
     
    <mx:ControlBar horizontalAlign="center">
        <mx:Button label="放大" click="resizeUp.end(); resizeUp.play();" />
        <mx:Button label="缩小" click="resizeDown.end(); resizeDown.play();" />
    </mx:ControlBar>
</mx:Panel>

本文源代码下载地址: http://flashview.ddvip.com/2009_11/Flash.rar

上一页  4 5 6 7 8 9 

Tags:积少成多 Flash Flex

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接