FLEX3结合J2EE项目,怎么从一个FLEX界面跳转到另外一个FLEX界面?
比如,从一个的登录界面跳转到主界面应该怎么实现?
[解决办法]
嗯嗯,是这样
小的项目,直接用states
比如:
<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()" xmlns:view = "view.*" horizontalAlign="center" verticalAlign="middle"><mx:Style source="style.css"/> <mx:Script> <![CDATA[ import Model.mod; import mx.controls.Alert; private var ModShiLi:mod = mod.getshili(); internal function init():void{ ModShiLi.addEventListener("LOGIN_USER",loginUserHandler); ModShiLi.addEventListener("LOGIN_ADMIN",loginAdminHandler); ModShiLi.addEventListener("LOGIN_FAILED",loginFailedHandler); ModShiLi.addEventListener("ExitUser",ExitUserHandler); this.currentState = "login"; } internal function loginUserHandler(evt:Event):void{ this.currentState = "usermain"; } internal function loginAdminHandler(evt:Event):void{ this.currentState = "adminmain"; } internal function loginFailedHandler(evt:Event):void{ //Alert.show("用户或密码错误","登录失败"); hlogin.alt_txt.text="用户或密码错误"; } internal function ExitUserHandler(evt:Event):void{ //this.currentState = "login"; var url:String = "http://www.meilady.com/csdn/"; var request:URLRequest = new URLRequest(url); navigateToURL(request,'_self'); // 在当前页面跳转 //navigateToURL(request,'_blank'); // 新窗口 } ]]> </mx:Script> <mx:ApplicationControlBar width="100%" height="70" dock="true" id="applicationcontrolbar1"> <mx:Canvas> <mx:Image source="image/csdnindex_piclogo.gif" x="20"/> </mx:Canvas> <mx:Label text="csdn设计大赛-工作总结提交系统" fontSize="20" fontWeight="bold" /> </mx:ApplicationControlBar> <mx:states> <mx:State name = "login"> <mx:AddChild position="lastChild"> <view:hlogin id="hlogin" /> </mx:AddChild> </mx:State> <mx:State name = "usermain"> <mx:AddChild position="lastChild"> <view:userpanel id="userpanel" /> </mx:AddChild> </mx:State> <mx:State name = "adminmain"> <mx:AddChild position="lastChild"> <view:adminpanel id="adminpanel" /> </mx:AddChild> </mx:State> </mx:states> <mx:transitions> <mx:Transition> <mx:Iris xFrom="10" targets="{[hlogin,userpanel,adminpanel]}"/> </mx:Transition></mx:transitions></mx:Application>
[解决办法]
flex是没有跳转这个概念的。。
如果小项目就用状态。
大项目就要动态加载module····
[解决办法]
慎用Module,
loader.unloadModule();很难卸掉的,反复切换导致的结果就是内存占用越来越大,界面越来越慢,最后内存溢出
[解决办法]
Application.currentstate=''
------解决方案--------------------
用state比较常见吧
[解决办法]
state 比较常见 也可以多建一个application 跳转的话就用 navigateToURL 直接切换application