flex4的viewstack之间的跳转
来源:互联网 发布:微信一夜暴富软件 编辑:程序博客网 时间:2024/06/10 23:55
我的文件目录结构
我的chatroom.mxml
<?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:hearain="hearain.*"><fx:Declarations><!-- 将非可视元素(例如服务、值对象)放在此处 --></fx:Declarations><fx:Script><![CDATA[]]></fx:Script><mx:ViewStack id="room"><s:NavigatorContent><hearain:login id="login"></hearain:login></s:NavigatorContent><s:NavigatorContent><hearain:welcome id="welcome" width="300" height="200"></hearain:welcome></s:NavigatorContent></mx:ViewStack></s:Application>
我的login.mxml组件
<?xml version="1.0" encoding="utf-8"?><s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="group1_creationCompleteHandler(event)" xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"><s:layout><s:VerticalLayout/></s:layout><fx:Script><![CDATA[import mx.containers.ViewStack;import mx.core.FlexGlobals;import mx.events.FlexEvent;private var vs:ViewStack; //vs是main.mxml中定义的viewstackprotected function group1_creationCompleteHandler(event:FlexEvent):void{// TODO Auto-generated method stubif(FlexGlobals.topLevelApplication is chatroom){if(FlexGlobals.topLevelApplication.room is ViewStack){vs = FlexGlobals.topLevelApplication.room as ViewStack;}}}//private function getChild(str:String):Object //这段代码是为了获得指定页面对应的对象//{//for each(var obj:Object in vs.getChildren()) //遍历vs中的所有子组件(即所有页面),页面不会太多,顶多一二十个,所以这个方法不会太耗时//{//if(obj.name === str) //如果是想找的页面,就返回这个对象。比如想找到welcome.mxml,则令str="welcome"//{//break;//}//}//return obj;//}protected function button1_clickHandler(event:MouseEvent):void{// TODO Auto-generated method stubvs.selectedIndex = 1;//跳转至welcomeu页面}]]></fx:Script><fx:Declarations><!-- 将非可视元素(例如服务、值对象)放在此处 --></fx:Declarations><s:Button x="200" y="121" label="登录" click="button1_clickHandler(event)" /></s:Group>
我的welcome.mxml组件
<?xml version="1.0" encoding="utf-8"?><s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"><s:layout><s:VerticalLayout/></s:layout><fx:Declarations><!-- 将非可视元素(例如服务、值对象)放在此处 --></fx:Declarations><s:Label id="w" text="欢迎窗口" /></s:Group>
我的运行结果:
点击登陆后跳转至welcome页面
0 0
- flex4的viewstack之间的跳转
- flex4.5使用viewstack实现页面跳转
- flex 使用viewstack实现页面的跳转
- 利用viewstack组件实现各个子组件之间的跳转和数据传递
- Flex4的页面跳转
- flex 使用viewstack实现页面的跳转(转)
- flex 使用viewstack实现页面的跳转(转)
- ViewStack的加载问题
- ViewStack的学习
- flex3和flex4之间的区别
- 解析Flex3与Flex4之间的区别
- flex3和flex4之间的区别
- Flex ViewStack页面跳转
- action 之间的跳转
- Activity 之间的跳转
- Servlet之间的跳转
- activity之间的跳转
- Servlet之间的跳转
- 百练/ 2015研究生上机测试-A:细胞分裂
- C++学习之构造函数、拷贝构造函数
- leetcode_110_Balanced Binary Tree
- 一个简单的Filter:安全级别与过滤器
- adb server didn'n ack
- flex4的viewstack之间的跳转
- 正确使用STL-MAP中Erase函数
- 算法课后题选作
- 最大后验估计MAP/最大似然估计MLE
- 高性能索引
- Java资源
- linux下使用优盘的方法
- leetcode--House Robber
- HDU 1098 Ignatius's Puzzle(解法汇集)