English 中文(简体)
2. 洞察力问题
原标题:ViewStack height problem

I have 2 VBox containers inside a ViewStack and the viewstack is inside HBox, I ve set both the height and width of the vboxes to 100% and the same for the viewstack. My problem is that the viewstack does not display the whole content of the container childs only a part of it and displays a vertical scroll, although the width is stretched to fill the whole width of the container hbox, why doesn t the viewstack stretches to show the 100% height of its child and does it for the width only?

主应用程序包含一个HBox,其中包含一个模块加载器控件,该控件加载包含视图堆栈的模块。

主要申请:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalScrollPolicy="on"
        xmlns:custom="components.*">
        <custom:RepeatingImage source="images/up_bg.gif" width="100%" height="100%" repeatX="true" repeatY="false" />
        <mx:Canvas width="100%">
            <custom:header id="header" />
            <mx:HBox id="content" horizontalGap="12" width="100%" x="12" y="180">
                <mx:ModuleLoader id="contentModuleLoader" width="100%" />                           
                <custom:sidead />
            </mx:HBox>
        </mx:Canvas>
        <custom:footer id="footer" />
    </mx:Application>

模块:

<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:custom="components.*" width="100%">
<mx:LinkBar dataProvider="stack" />
<mx:ViewStack id="stack" width="100%">
<mx:VBox id="Content" label="First View" width="100%">  
        <mx:Canvas width="100%">
            //controls here
        </mx:Canvas>

        <mx:Canvas width="100%">
            <mx:HBox width="100%">
                <mx:VBox width="100%">
                    //more controls and containers
                </mx:VBox>
            </mx:HBox>
        </mx:Canvas>
    </mx:VBox>

    <mx:VBox label="Second View">
 //controls
</mx:VBox>
</mx:ViewStack>
</mx:Module>
问题回答

您是否尝试使用<代码>使ToContent 观点的财产?

同意需要看代码,但依我看,HBox可能是限制UI元素 - 确保其大小足够大,不需要在ViewStack中使用滚动条。

您可以经常使用backgroundColorbackgroundAlpha来诊断此类问题,或者使用FlexSpy或类似工具来解决。

why doesn t the viewstack stretches to show the 100% height of its child and does it for the width only?

我昨天应该注意到这个问题。将任何内容设为100%会使其适合父容器,而不是子元素。我试图按照您的代码操作,但必须承认我迷失在其中。我相当确定问题存在于您的viewstack之上(在父子关系中,与代码顺序无关)。

您是否尝试修改婚后财产?

在ViewStack中有一个名为“resizeToContent”的属性,您可以将其设置为true。那应该就是您想要的。





相关问题
Disable button tooltip in AS3

I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?

Multiple Remote call made simultenously

I was making multiple remote calls and they are done sequentially and when I am getting a result event back it s triggering calls to all the methods with ResultEvent as an argument . I am supposed to ...

Attaching a property to an event in Flex/AS3

I have a parameter that needs to be passed along with an event. After unsuccessful attempts to place it on the type by extending the class, I ve been advised in another SO question to write a custom ...

Clearing RSL in Cache

I have built a flex application which has a "main" project and it is assosciated with a few RSL s which are loaded and cached once i run my "main" application. The problem i am facing is that the ...

What s a good way of deserializing data into mock objects?

I m writing a mock backend service for my flex application. Because I will likely need to add/edit/modify the mock data over time, I d prefer not to generate the data in code like this: var mockData =...

AS3 try/catch out of memory

I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...

热门标签