Flex 4 - s:滚动

发布于 2024-10-03 16:28:16 字数 2038 浏览 1 评论 0原文

我创建了一个项目,其中包含 mx:ViewStack 作为它的第一个容器。

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
           xmlns:s="library://ns.adobe.com/flex/spark"
           xmlns:comp="mycomp.*"
           xmlns:mx="library://ns.adobe.com/flex/mx"
           height="100%" width="100%"
           minHeight="600"  minWidth="800">
<s:layout>
    <s:VerticalLayout horizontalAlign="center" />
</s:layout><mx:ViewStack horizontalCenter="0"
              verticalCenter="0"
              id="contentVs"
              height="100%"
              width="100%">
    <s:NavigatorContent name="biography"
                        label="Biography"
                        width="100%"
                        height="100%">
        <comp:Biography />
    </s:NavigatorContent>
    <s:NavigatorContent name="collections"
                        label="Collections"
                        width="100%"
                        height="100%">
        <comp:Collections/>

在 mxViewStack 内的每个 s:NavigatorContent 中,我都有一个自定义 s:SkinnableContainer 组件。在这些组件中,我添加了 as:Scroller 作为第一个子容器。

   <?xml version="1.0" encoding="utf-8"?>
   <s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                  xmlns:s="library://ns.adobe.com/flex/spark" 
                  xmlns:mx="library://ns.adobe.com/flex/mx"
                  width="100%" height="100%"
                  creationComplete="this_creationCompleteHandler(event)">
<s:Scroller id="scroller1"
            width="100%"
            height="100%">
    <s:Group>           
        <s:BorderContainer width="100%" height="100%" borderVisible="true">

请注意,应用程序的宽度和高度均为 100%。

现在,当我减小浏览器的大小时,滚动条不会出现。在 s:NavigatorContent(始终在 ViewStack 内)的一种情况下,会出现滚动条。

我很困惑为什么它只出现在一种情况下。如果我将策略设置为on,则 s:Scroller 会出现,但即使我将浏览器设置得非常小,它也会被禁用。

另外,我似乎找不到一种方法将这些滚动条涂成黑色。

谢谢。

I created a project which includes an mx:ViewStack as it's first container.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
           xmlns:s="library://ns.adobe.com/flex/spark"
           xmlns:comp="mycomp.*"
           xmlns:mx="library://ns.adobe.com/flex/mx"
           height="100%" width="100%"
           minHeight="600"  minWidth="800">
<s:layout>
    <s:VerticalLayout horizontalAlign="center" />
</s:layout><mx:ViewStack horizontalCenter="0"
              verticalCenter="0"
              id="contentVs"
              height="100%"
              width="100%">
    <s:NavigatorContent name="biography"
                        label="Biography"
                        width="100%"
                        height="100%">
        <comp:Biography />
    </s:NavigatorContent>
    <s:NavigatorContent name="collections"
                        label="Collections"
                        width="100%"
                        height="100%">
        <comp:Collections/>

In each s:NavigatorContent inside the mxViewStack I have a custom s:SkinnableContainer component. In these components I added a s:Scroller as the first child container.

   <?xml version="1.0" encoding="utf-8"?>
   <s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                  xmlns:s="library://ns.adobe.com/flex/spark" 
                  xmlns:mx="library://ns.adobe.com/flex/mx"
                  width="100%" height="100%"
                  creationComplete="this_creationCompleteHandler(event)">
<s:Scroller id="scroller1"
            width="100%"
            height="100%">
    <s:Group>           
        <s:BorderContainer width="100%" height="100%" borderVisible="true">

Note that the application has 100% for both width and height.

Now when I decrease the size of the browser the scroller does not appear. In one of the s:NavigatorContent(always inside the ViewStack) cases the scroller appears.

I am puzzled why it does appear in one case only. If I set the policy to on the s:Scroller appears but it is disabled even if I make my browser pretty small.

Plus I can't seem to find a way to color these scrollers to black.

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦冥 2024-10-10 16:28:16

我无法从您的代码示例中准确地看到,但是这一行:

<s:BorderContainer width="100%" height="100%" borderVisible="true">

使它看起来像滚动条组的内容设置了 height="100%" 。

仅当组的内容比其本身更宽或更高时,滚动条才会显示滚动条。

尝试将组的宽度和高度设置为 100%,并确保组的内容高于 Scroller。

例如。

<s:Scroller width="100%" height="100%">
    <s:VGroup width="100%" height="100%">

        <s:Label text="The rectangle below is very tall" />

        <!-- just a boring gradient rectangle -->
        <s:Rect width="200" height="1500">
            <s:fill>
                <s:LinearGradient rotation="90">
                    <s:GradientEntry color="0xFFFF00" />
                    <s:GradientEntry color="0x00FFFF" />
                </s:LinearGradient>
            </s:fill>
        </s:Rect>

    </s:VGroup>
</s:Scroller>

I can't see exactly from your code sample, but this line:

<s:BorderContainer width="100%" height="100%" borderVisible="true">

makes it look like the content of the scroller's group has height="100%" set.

The scroller will only show a scrollbar if it's Group's content is either wider or taller than itself.

Try setting the group's width and height to 100% and ensuring that the content of the Group is taller than the Scroller.

eg.

<s:Scroller width="100%" height="100%">
    <s:VGroup width="100%" height="100%">

        <s:Label text="The rectangle below is very tall" />

        <!-- just a boring gradient rectangle -->
        <s:Rect width="200" height="1500">
            <s:fill>
                <s:LinearGradient rotation="90">
                    <s:GradientEntry color="0xFFFF00" />
                    <s:GradientEntry color="0x00FFFF" />
                </s:LinearGradient>
            </s:fill>
        </s:Rect>

    </s:VGroup>
</s:Scroller>
如梦初醒的夏天 2024-10-10 16:28:16

我用 static(width="1200" height="800") 大小替换了 Viewstack 上的相对大小,这样就成功了。

<s:Group width="100%" height="100%">        
    <s:Scroller width="100%" height="100%">
        <s:VGroup horizontalAlign="center">
            <mx:ViewStack horizontalCenter="0"
                          verticalCenter="0"
                          id="contentVs"
                          width="1200" height="800">
                <s:NavigatorContent name="biography"

关于更改 Scroller 组件的颜色,我必须创建自己的皮肤。

Spark.components.Scroller 的皮肤以及:

VScrollBarSkin
VScrollBarTrackSkin
VScrollBarThumbSkin
滚动条向上按钮外观
ScrollBarDownButtonSkin

与 HScrollBar 相同...

I replaced the relative size ont he Viewstack with a static(width="1200" height="800") size and that did the trick.

<s:Group width="100%" height="100%">        
    <s:Scroller width="100%" height="100%">
        <s:VGroup horizontalAlign="center">
            <mx:ViewStack horizontalCenter="0"
                          verticalCenter="0"
                          id="contentVs"
                          width="1200" height="800">
                <s:NavigatorContent name="biography"

Concerning changing color on the Scroller component I had to create my own skins.

A skin for the spark.components.Scroller and also:

VScrollBarSkin
VScrollBarTrackSkin
VScrollBarThumbSkin
ScrollBarUpButtonSkin
ScrollBarDownButtonSkin

the same goes for the HScrollBar...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文