flex状态之间的切换

<?xml version="1.0" encoding="utf-8"?>
 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx"
 
                           minWidth="955" minHeight="600" xmlns:local="*" xmlns:myPacket="myPacket.*">
 
        <s:states>
 
                <s:State name="nomalA"/>
 
                <s:State name ="nomalB"/>
 
                <s:State name="nomalC"/>
 
                <s:State name="nomalD"/>
 
        </s:states>
 
       
        <s:transitions>
 
                <s:Transition toState="nomalA">
 
                                <s:Sequence        target="{group1}">
 
                                <s:Fade alphaFrom="0" alphaTo="1" duration="4000"/>
 
                                </s:Sequence>
 
                </s:Transition>
 
                <s:Transition toState="nomalB">
 
                                <s:Sequence        target="{group2}">
 
                                        <s:Fade alphaFrom="0" alphaTo="1" duration="4000"/>
 
                                </s:Sequence>
 
                </s:Transition>
 
        </s:transitions>
 
        <fx:Script>
 
                <![CDATA[
 
                        private var ADD:String = "add";
 
                        private var NORMALA:String = "nomalA";
 
                        private var NORMALB:String = "nomalB";
 
                        private var NORMALC:String = "nomalC";
 
                        private var NORMALD:String = "nomalD";

                        protected function button1_clickHandler(event:MouseEvent):void
 
                        {
 
                                if(currentState == NORMALA)currentState = NORMALB;
 
                                else if(currentState == NORMALB)currentState = NORMALC;
 
                                else if(currentState == NORMALC)currentState = NORMALD;
 
                                else if(currentState == NORMALD)currentState = NORMALA;
 
                                else return;
 
                        }

                ]]>
 
        </fx:Script>
 
        <fx:Declarations>
 

        </fx:Declarations>
 
       
        <s:Group id="group1" includeIn="nomalA">
 
                <s:Button id="nostudent1" x="114" y="80" label="nostudent 1"/>
 
        </s:Group>
 
        <s:Group id="group2" includeIn="nomalB">
 
                <s:Button id="nostudent2" x="114" y="80" label="nostudent 2"/>
 
        </s:Group>
 
        <s:Group id="group3" includeIn="nomalC">
 
                <s:Button id="nostudent3" x="114" y="80" label="nostudent 3"/>
 
        </s:Group>
 
        <s:Group id="group4" includeIn="nomalD">
 
                <s:Button id="nostudent4" x="114" y="80" label="nostudent 4"/>
 
        </s:Group>
 
       
        <s:Button x="309" y="312" label="click" click="button1_clickHandler(event)"/>
 

</s:Application>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值