Flex开门效果


<?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_width: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>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Flex 常用属性及作用效果如下: 1. `display: flex;` - 作用:将容器设置为 Flex 布局。 - 效果:容器内的子元素可以使用 Flex 布局相关的属性。 2. `flex-direction: row|row-reverse|column|column-reverse;` - 作用:确定主轴的方向。 - 效果:决定子元素在容器内的排列方向。 3. `flex-wrap: nowrap|wrap|wrap-reverse;` - 作用:确定子元素是否换行。 - 效果:决定子元素是否在一行显示,或者多行显示。 4. `justify-content: flex-start|flex-end|center|space-between|space-around;` - 作用:确定子元素在主轴上的对齐方式。 - 效果:决定子元素在主轴上的排列方式,例如靠左、居中、靠右等。 5. `align-items: flex-start|flex-end|center|baseline|stretch;` - 作用:确定子元素在交叉轴上的对齐方式。 - 效果:决定子元素在交叉轴上的排列方式,例如靠上、居中、靠下等。 6. `align-content: flex-start|flex-end|center|space-between|space-around|stretch;` - 作用:确定多行子元素在交叉轴上的对齐方式。 - 效果:当子元素换行时,决定多行子元素在交叉轴上的排列方式。 7. `flex-grow: <number>;` - 作用:确定子元素的放大比例。 - 效果:决定子元素在有剩余空间时的放大比例。 8. `flex-shrink: <number>;` - 作用:确定子元素的缩小比例。 - 效果:决定子元素在空间不足时的缩小比例。 9. `flex-basis: <length>|auto;` - 作用:确定子元素的基准大小。 - 效果:决定子元素在没有放大或缩小时的初始大小。 10. `flex: none|auto|<flex-grow> <flex-shrink> <flex-basis>;` - 作用:综合设置子元素的放大比例、缩小比例和基准大小。 - 效果:可以一次性设置子元素的 flex-grow、flex-shrink 和 flex-basis 属性。 这些是 Flex 布局中常用的属性及其作用效果。注意,以上属性需要应用在容器元素上,以影响容器内的子元素布局。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值