flex state example
?The first flex state example: <?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/halo" width="400" height="300"> <!--定义了二个状态,系统默认状态为第一个--> <s:states> <s:State name="State1"/> <s:State name="State2"/> </s:states> <mx:VBox verticalCenter="0" horizontalCenter="0" > <s:Button <!--状态为state1时,设置label属性和单击事件--> label.State1="Small" click.State1="currentState='State2'" <!--状态为state2时,设置width属性、height属性、label2属性和单击事件--> width.State2="200" height.State2="200" label.State2="BIG" click.State2="currentState='State1'"/> <!--状态为state2时,该label才显示--> <mx:Label includeIn="State2" width="100%" text="State 2 Only" textAlign="center"/> </mx:VBox> </s:Application>
2、为一个状态设定属性,样式和事件
<?xml version="1.0" encoding="utf-8"?> <!-- statesNewStatesReparent.mxml --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/halo" xmlns:s="library://ns.adobe.com/flex/spark"> <s:layout> <s:VerticalLayout/> </s:layout> <s:states> <s:State name="Parent1"/> <s:State name="Parent2"/> </s:states> <s:HGroup> <s:Panel id="Panel1" height="100" width="100" title="Panel 1"> <s:Button id="setCB" includeIn="Parent1"/> </s:Panel> <s:Panel id="Panel2" height="100" width="100" title="Panel 2"> <fx:Reparent target="setCB" includeIn="Parent2"/> </s:Panel> </s:HGroup> <s:HGroup> <s:Button label="Parent 1" click="currentState='Parent1'" enabled.Parent1="false"/> <s:Button label="Parent 2" click="currentState='Parent2'" enabled.Parent2="false"/> </s:HGroup> </s:Application>
6、states简单例子 <?xml version="1.0"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/halo" xmlns:s="library://ns.adobe.com/flex/spark"> <s:states> <!-- Define the new view states. --> <s:State name="default"/> <s:State name="NewButton"/> </s:states> <s:VGroup id="g1"> <s:HGroup> <!-- Disable Button in the NewButton view state. 当前状态是NewButton时,b1按钮失效 --> <s:Button id="b1" label="Click Me" enabled.NewButton="false"/> <!-- Add a new child control to the VBox. --> <!-- 状态为NewButton时,该按钮才显示 --> <s:Button id="b2" label="New Button" includeIn="NewButton"/> </s:HGroup> <s:Button label="Change to NewButton state" click="currentState='NewButton';"/> <!-- Define Button control to switch to default view state. --> <s:Button label="Change to default view state" click="currentState='default';"/> </s:VGroup> </s:Application> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- XML::Parser perl module is required for intlt
- c – 是否可以通过溢出C中的第一个元素来写入数组
- 使用NSFetchedResultsController对描述符进行排序
- 最快让你上手ReactiveCocoa之基础篇
- mono-3.2.3编译 VB.net Error : VBNC2017: The l
- cocos2dx3.2开发 RPG《Flighting》(四)预先加载
- ocp Oracle.1z0-053 711--11
- c – 如果你只有一个标识符,#define会怎么做
- Oracle 存储过程(procedure)和函数(Function)
- 2cocos2dx别踩白块游戏案例