代码之家  ›  专栏  ›  技术社区  ›  Craig Myles

是否可以防止flex应用程序在运行时被调整大小?

  •  0
  • Craig Myles  · 技术社区  · 15 年前

    据我所知,Flex应用程序的resize属性是在XML配置文件中设置的:

    <!--Whether the user can resize the window. Optional. Default true.-->
    <!--<resizable></resizable>-->
    

    private function creationComplete():void {
        this.systemManager.stage.addEventListener(Event.RESIZE, resizeListener);
    }
    
    private function resizeListener(evt:Event):void {
        evt.preventDefault();
    }
    

    任何帮助都将不胜感激。

    5 回复  |  直到 15 年前
        2
  •  4
  •   sp_m    13 年前

    有另一种方法可以在不设置描述符文件属性的情况下实现这一点。

    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" showGripper="false"
                        layout="vertical" showStatusBar="false"
                        applicationComplete="init()">
    
    <mx:Script>
        <![CDATA[
            import mx.events.FlexNativeWindowBoundsEvent;
    
            private function init():void
            {
                this.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
                nativeWindow.addEventListener(NativeWindowBoundsEvent.RESIZING, onAppResize);
            }
    
            private function onAppResize(e:NativeWindowBoundsEvent):void
            {
                    e.preventDefault();
            }
    
       ]]>
    </mx:Script>
    

        3
  •  0
  •   Martin    15 年前

    根据 manual resizable 是只读属性。 所以这可能是不可能的。

        4
  •  0
  •   Sam DeHaan    14 年前

    因为这已经坏死了,我很好奇:

    我使用以下代码实现了从可调整大小到不可调整大小的切换:

    private var maxMode:Boolean = true;
    
    protected function switchMode():void
    {
        if (maxMode){
            //I chose to freeze the app at current size
            //You could also set the min/max to hard coded values
            this.maxWidth = this.width;
            this.minWidth = this.width;
            this.maxHeight = this.height;
            this.minHeight = this.height;
        }
        else {
            //default values for WindowedApplication
            this.maxWidth = 2880;
            this.minWidth = 0;
            this.maxHeight = 2880;
            this.minHeight = 0;
        }
    
        maxMode= !maxMode
    }
    

        5
  •  -1
  •   Nemi    14 年前

    尝试添加退货:

    evt.preventDefault();
    return;
    
    推荐文章