从不同的mxml组件中的TitleWindow调用Application.application.enable [英] Calling Application.application.enable from a TitleWindow in a different mxml component
问题描述
application.enable = false
这样用户不能使用应用程序中的任何组件,并且仍然可以使用TitleWindow中的组件。
问题其实。当TitleWindow关闭的时候,我想让他把应用程序还原到
application.enable = true
重新启用应用程序。但是我不能从TitleWindow.mxml中调用这段代码。
我怎样才能做到这点?
<?xml version =1.0encoding =utf-8?>
< 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 =10y =40width =565height =400layout =absolute>
< / mx:面板>
< mx:Button x =508y =10label =Acederclick =openWindow();/>
< / mx:应用程序>
还有一个标题窗口。一旦他们是相同的。
$ b Login.mxml
<?xml version =1.0encoding =utf-8?>
< 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>
任何帮助都非常好。感谢。
$ c $> b
$ b> public function closeWindow():void
{
PopUpManager.removePopUp(this);
Application.application.enabled = true;
另外还有一个更简单的方法来实现以下功能:
这样用户就不能使用应用程序中的任何组件,而仍然可以使用TitleWindow中的组件。
即使用模式弹出窗口。将 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 = false
That 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 = true
Wich 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 way the user cant use any of the components in the application, and still can use the components in the TitleWindow.
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!