zoukankan      html  css  js  c++  java
  • Flex登录——开关门特效

    login时开门,logout时关门。源代码贴在后面


    Xml代码
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
       xmlns:eff="com.adobe.ac.mxeffects.*"  
       paddingBottom="0" paddingLeft="0" paddingTop="0" paddingRight="0"
       horizontalAlign="center" verticalAlign="middle" xmlns="*" viewSourceURL="srcview/index.html">

    <mx:Script>
          <![CDATA[
              import com.adobe.ac.mxeffects.Gate;
              import com.adobe.ac.mxeffects.Flip;
              import mx.effects.Sequence;
              import mx.effects.Parallel;
              import mx.effects.Resize;
              import mx.effects.Fade;
              import mx.effects.Iris;
              import com.adobe.ac.mxeffects.DistortionConstants;
              
              private const min_int = 350;
              private const min_height:int = 200;

              public function gotoChatRoom() : void {
                 var mySequence:Sequence = new Sequence();

                 var gate:Gate = new Gate(login);
                 gate.siblings = [ chatRoom ];
                 gate.direction = DistortionConstants.LEFT;    
                 gate.smooth = true;
                 gate.distortion = 10;
                 gate.mode = Gate.OPEN;
                 gate.duration = 1000;
                 mySequence.addChild(gate);
               
                 var parallel:Parallel = new Parallel();
                 var resize:Resize = new Resize();
                 resize.target = loginStack;
                 resize.widthTo = this.width-20;
                 resize.heightTo = this.height-20;
                 resize.duration = 1000;
                 parallel.addChild(resize);
                 
                 resize = new Resize();
                 resize.target = chatRoom;
                 resize.widthTo = this.width-20;
                 resize.heightTo = this.height-20;
                 resize.duration = 1000;
                 parallel.addChild(resize);             
                 mySequence.addChild(parallel);
                 
                 mySequence.play();
              }
              
              public function gotoLogin() : void {
                 var mySequence:Sequence = new Sequence();

                 var gate:Gate = new Gate(chatRoom);
                 gate.siblings = [ login ];
                 gate.direction = DistortionConstants.LEFT;    
                 gate.smooth = true;
                 gate.distortion = 10;
                 gate.mode = Gate.CLOSE;
                 gate.duration = 1000;
                 mySequence.addChild(gate);
               
                 var parallel:Parallel = new Parallel();
                 var resize:Resize = new Resize();
                 resize.target = loginStack;
                 resize.widthTo = min_width;
                 resize.heightTo = min_height;
                 resize.duration = 1000;
                 parallel.addChild(resize);
                 
                 resize = new Resize();
                 resize.target = chatRoom;
                 resize.widthTo = min_width;
                 resize.heightTo = min_height;
                 resize.duration = 1000;
                 parallel.addChild(resize);             
                 mySequence.addChild(parallel);
                 
                 mySequence.play();
              }
          ]]>

       </mx:Script>
        
       <mx:Style source="/assets/OSX.css"/>

       <mx:VBox>
       <mx:ViewStack id="loginStack" width="350" height="200">
         <mx:Panel id="login" title="Login" horizontalAlign="center"  
           verticalAlign="middle" backgroundColor="0xAAAAAA" >       
           <mx:Form >         
               <mx:FormItem label="Username">
                   <mx:TextInput id="userName" />
               </mx:FormItem>             
               <mx:FormItem label="Password">
                   <mx:TextInput displayAsPassword="true" id="password"  
                     enter="gotoChatRoom();"/>
               </mx:FormItem>       
               <mx:FormItem>
                   <mx:Button label="Login" click="gotoChatRoom();" />
               </mx:FormItem>         
           </mx:Form>         
         </mx:Panel>
          
         <mx:Panel id="chatRoom" title="Chat Room" >           
           <mx:VBox width="100%" height="100%">
             <mx:TextArea id="log" fontSize="12" width="100%" height="100%"  
               editable="false" />
           </mx:VBox>
           <mx:ControlBar>
             <mx:TextInput id="msg" width="100%" fontSize="12" enter=""/>
               <mx:Button label="Send" click="" />  
               <mx:Button label="Logout" click="gotoLogin()" />  
           </mx:ControlBar>       
         </mx:Panel>
       </mx:ViewStack>
       </mx:VBox>

    </mx:Application>  


    本贴来自天极网群乐社区--http://q.yesky.com/group/review-17641208.html


    类别:flex学习 查看评论
  • 相关阅读:
    [算法]统计排序(桶排序)
    [算法]使用bitmap高效进行矩阵运算
    [C++]搞清楚类中构造与析构的顺序
    [C++]关于友元的总结
    [mysql]视图(转)
    [mysql]存储过程(转)
    [C++]对象模型总结
    [mysql]Linux下C语言连接mysql
    [python]使用xml.dom读写XML文件
    Windows 10 64位操作系统 下安装、配置、启动、登录、连接测试oracle 11g
  • 原文地址:https://www.cnblogs.com/dorothychai/p/2267952.html
Copyright © 2011-2022 走看看