问题描述
我有一个Flex RIA应用程序,在应用程序标签中有一个按钮,当它从另一个.mxml文件中按下一个TitleWindow时,并设置应用程序是 $ c $> b
$ b> public function closeWindow():void
{
PopUpManager.removePopUp(this);
Application.application.enabled = true;
另外还有一个更简单的方法来实现以下功能:即使用模式弹出窗口。将 createPopUp 的第三个参数设置为 true 就是这样 - 您不必启用/禁用应用程序手动:flex会照顾它。
PopUpManager.createPopUp(this,Login,true);
一旦您调用 removePopUp 。
Good day.
I have a Flex RIA App, and in the application tag there is a button when its pressed calls upon a TitleWindow from another .mxml file, and sets
application.enable = falseThat way the user cant use any of the components in the application, and still can use the components in the TitleWindow.
The problem its. When the TitleWindow is close i want him to restore the application back to
application.enable = trueWich enables the application once again. But i can't call that code from inside the TitleWindow .mxml
How can i do it?..
Here is the Source:
Loja.mxml
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="585" height="450" xmlns:ns1="com.*"> <mx:Style source="theme/simplicitygray.css" /> <mx:Script> <![CDATA[ import mx.managers.PopUpManager; private var clientid = 0; public function openWindow() : void { if (clientid == 0) { PopUpManager.createPopUp(this,Login,false); application.enabled = false; } else { PopUpManager.createPopUp(this,Conta,false); application.enabled = false; } } ]]> </mx:Script> <mx:Panel x="10" y="40" width="565" height="400" layout="absolute"> </mx:Panel> <mx:MenuBar x="10" y="10" width="565" height="22"></mx:MenuBar> <mx:Button x="508" y="10" label="Aceder" click="openWindow();"/> </mx:Application>And one of the title windows. Once they are the same.
Login.mxml
<?xml version="1.0" encoding="utf-8"?> <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="350" height="200" creationComplete="centerWindow()" showCloseButton="true" close="closeWindow()" title="Login"> <mx:Script> <![CDATA[ import mx.managers.PopUpManager; public function centerWindow():void { PopUpManager.centerPopUp(this); } public function closeWindow():void { PopUpManager.removePopUp(this); } ]]> </mx:Script> </mx:TitleWindow>Any help is greattly apreciated. Thanks.
解决方案application is a static property of the Application class and can be called from the TitleWindow
public function closeWindow():void { PopUpManager.removePopUp(this); Application.application.enabled = true; }BTW, There is another easier way to achieve the following:
That is to use a modal popup. Set the third parameter of the createPopUp to true and that's it - you don't have to enable/disable the application manually: flex will take care of it.
PopUpManager.createPopUp(this,Login, true);application will automatically become functional once you call removePopUp.
这篇关于从不同的mxml组件中的TitleWindow调用Application.application.enable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!