0

表示サイズを変更するメソッドを実装しました。

最大化をクリックすると、ビュースタック内のいくつかのボタンの位置が変更されます。問題は、ビューを復元するとボタンが消えることです。

誰かが私を助けることができますか?

{       
    nativeWindow.addEventListener(NativeWindowBoundsEvent.RESIZING, onAppResize);

    nativeWindow.addEventListener(NativeWindowBoundsEvent.RESIZE, onAppResize);

    nativeWindow.addEventListener(NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING,onAppMaximized);

    var screenBounds:Rectangle = Screen.mainScreen.bounds;
    nativeWindow.x = 10;
    nativeWindow.y = 10;    
}

private function onAppMaximized(e:NativeWindowDisplayStateEvent):void
{

    if(String(e.afterDisplayState) == "maximized" && DisplayMaximized == false)
    {
        e.preventDefault();

        nativeWindow.x = 10;
        nativeWindow.y = 10;

        AppImageWidth = 1280;
        AppImageHeight = 900;

        nativeWindow.width = 1280;
        nativeWindow.height = 900;

        viewstack.createComponentsFromDescriptors(true);

        viewstackBuchungen.width = 1206;
        viewstackBuchungen.height = 600;

        Button.x = 1135;
        Button.y = 608;

        Button2.x = 1135;
        Button2.y = 608;

        DisplayMaximized = true;
    }
    else if(String(e.afterDisplayState) == "maximized" && DisplayMaximized == true)
    {
        e.preventDefault();

        AppImageWidth = 1024;
        AppImageHeight = 600;

        nativeWindow.width = 1024;
        nativeWindow.height = 600;

        viewstackBuchungen.width = 950;
        viewstackBuchungen.height = 313;

        Button.x = 879;
        Button.y = 321;

        Button2.x = 879;
        Button2.y = 321;

        DisplayMaximized = false;
    }
}
4

1 に答える 1

0

ご回答有難うございます。.move(x,y)で動かしてみました。何も変わっていません...

ボタンは異なるナビゲーター コンテンツにあるため、同じ位置にあります。

<
s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library:// ns.adobe.com/flex/mx" creationComplete="init();" width="1024" height="600">
        private function init():void
        {
            nativeWindow.addEventListener(NativeWindowBoundsEvent.RESIZING, onAppResize);
            nativeWindow.addEventListener(NativeWindowBoundsEvent.RESIZE, onAppResize);

            nativeWindow.addEventListener(NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING,onAppMaximized);
            nativeWindow.x = 10;
            nativeWindow.y = 10;
        }
        private function onAppResize(e:NativeWindowBoundsEvent):void
        {
            e.preventDefault();
        }
        private function onAppMaximized(e:NativeWindowDisplayStateEvent):void
        {
            if(String(e.afterDisplayState) == "maximized" && DisplayMaximized == false)
            {
                e.preventDefault();

                nativeWindow.x = 10;
                nativeWindow.y = 10;

                nativeWindow.width = 1280;
                nativeWindow.height = 900;

                viewstack1.createComponentsFromDescriptors(true);

                viewstack1.width = 1206;
                viewstack1.height = 600;

                button1.move(1135,608);

                button2.move(1135,608);

                DD1.move(1082,608);

                DisplayMaximized = true;
            }
            else if(String(e.afterDisplayState) == "maximized" && DisplayMaximized == true)
            {
                e.preventDefault();

                nativeWindow.width = 1024;
                nativeWindow.height = 600;

                viewstack1.width = 950;
                viewstack1.height = 313;


                button1.move(879,321);

                button2.move(879,321);

                DD1.move(826,321);

                DisplayMaximized = false;
            }
        }
    ]]>
</fx:Script>
<fx:Declarations>
    <!-- Platzieren Sie nichtvisuelle Elemente (z. B. Dienste, Wertobjekte) hier -->
</fx:Declarations>

<s:Group x="16" y="113" width="1254" height="463">
    <mx:ViewStack id="viewstack1" x="0" y="24" width="950" height="313" selectedIndex="0" creationPolicy="all">
        <s:NavigatorContent width="100%" height="100%" label="Nav1" id="nav1" creationPolicy="all">
            <mx:AdvancedDataGrid id="grid1" x="0" y="0" width="100%" height="100%"
                                 designViewDataType="flat"
                                 editable="true" horizontalScrollPolicy="off"
                                 sortableColumns="false" resizableColumns="false" draggableColumns="false">
                <mx:columns>
                    <mx:AdvancedDataGridColumn dataField="test1" headerText="test1" width="35"/>
                </mx:columns>
            </mx:AdvancedDataGrid>
            <s:Button x="879" y="321" label="Button1" id="button1"/>
        </s:NavigatorContent>
        <s:NavigatorContent width="100%" height="100%" label="Nav2" id="nav2" creationPolicy="all">
            <mx:AdvancedDataGrid id="grid2" x="0" y="0" width="100%" height="100%"
                                 designViewDataType="flat"
                                 editable="true" horizontalScrollPolicy="off"
                                 sortableColumns="false" resizableColumns="false" draggableColumns="false">
                <mx:columns>
                    <mx:AdvancedDataGridColumn dataField="test2" headerText="test2" width="35"/>
                </mx:columns>
            </mx:AdvancedDataGrid>
            <s:Button x="879" y="321" label="Button2" id="button2" />
        </s:NavigatorContent>
        <s:NavigatorContent width="100%" height="100%" label="Nav3"  id="nav3" creationPolicy="all">
            <mx:AdvancedDataGrid id="grid3" x="0" y="0" width="100%" height="100%"
                         designViewDataType="flat"
                         editable="true" horizontalScrollPolicy="off"
                         sortableColumns="false" resizableColumns="false" draggableColumns="false">
                <mx:columns>
                    <mx:AdvancedDataGridColumn dataField="test3" headerText="test3" width="35"/>
                </mx:columns>
            </mx:AdvancedDataGrid>
            <s:DropDownList x="826" id="DD1" y="321" width="125" prompt="DD1" alpha="1"/>
        </s:NavigatorContent>
    </mx:ViewStack>
    <s:TabBar x="0" y="0" dataProvider="{viewstack1}" />
</s:Group>

于 2012-05-18T12:43:34.953 に答える