是否可以防止 Flex 应用程序在运行时调整大小?
据我所知,Flex 应用程序的调整大小属性是在 XML 配置文件中设置的:
<!--Whether the user can resize the window. Optional. Default true.-->
<!--<resizable></resizable>-->
但是,如果我将此属性设置为 true,是否有办法在运行时动态关闭此属性?例如,我的应用程序有两种视图模式 - 迷你和最大。我想阻止最终用户在迷你模式下调整应用程序的大小。我尝试使用以下代码阻止调整大小,但它似乎不起作用:
private function creationComplete():void {
this.systemManager.stage.addEventListener(Event.RESIZE, resizeListener);
}
private function resizeListener(evt:Event):void {
evt.preventDefault();
}
任何帮助将不胜感激。
From what I can gather, the resize property of a Flex application is set in the XML config file:
<!--Whether the user can resize the window. Optional. Default true.-->
<!--<resizable></resizable>-->
However, if I set this attribute to true, is there a way to turn this off dynamically at runtime? For example, my application has two view modes - mini and maxi. I would like to prevent the end user from being able to resize the application when in mini mode. I tried prevent the resize using the following code but it does not seem to work:
private function creationComplete():void {
this.systemManager.stage.addEventListener(Event.RESIZE, resizeListener);
}
private function resizeListener(evt:Event):void {
evt.preventDefault();
}
Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
还有另一种方法可以在不设置描述符文件属性的情况下执行此操作。
这是代码:
希望这有帮助。
There is another way to do that without setting the descriptor file property.
Here is the code:
Hope this helps.
您需要创建一个新的 NativeWindow 实例并将您的应用程序重新设置为该实例。当您创建新的 NativeWindow 时,您可以在初始化时设置选项,包括调整大小。
http://help.adobe.com /en_US/FlashPlatform//reference/actionscript/3/flash/display/NativeWindowInitOptions.html
You'd need to create a new NativeWindow instance and reparent your application into that. When you create a new NativeWindow, you've got options you can set at Initialisation time, including resizable.
http://help.adobe.com/en_US/FlashPlatform//reference/actionscript/3/flash/display/NativeWindowInitOptions.html
根据手册,
ressized
是只读属性。所以这可能是不可能的。
According to manual,
resizable
is read-only property.So it's probably not possible.
因为这已经死了,我很好奇:
我能够使用以下代码实现从可调整大小到不可调整大小的切换:
但是,用户仍然会在应用程序的边缘显示调整大小的鼠标图标。
As this was already necro'd, and I was curious:
I was able to implement a switch from resizable to not with the following code:
The user is however still shown the resize mouse icons on the edges of the app.
尝试添加返回:
Try to add return: