简体   繁体   English

将扩展的Scroller添加到Flex中的扩展的Spark List

[英]Add extended Scroller to extended spark List in Flex

I'm trying to add a custom Scroller.as (extended from spark.components.Scroller ) to a InfiniteScrollList.as (extended from spark.components.list ) 我正在尝试将自定义Scroller.as (从spark.components.Scroller扩展)添加到InfiniteScrollList.as (从spark.components.list扩展)。

I wrote the following MXML code: 我编写了以下MXML代码:

<list:InfiniteScrollList width="100%" height="100%" id="EventsList" useVirtualLayout="true">
    <list:scroller>
         <list:Scroller/> <!-- The Scroller.as Class -->
    </list:scroller>
</list:InfiniteScrollList>

The List behavior works well but the extended Scroller component does not function at all. List行为运行良好,但扩展的Scroller组件根本无法运行。
What is the correct way to add this scroller functionality (in MXML or ActionScript) to the list? 将此滚动条功能(在MXML或ActionScript中)添加到列表的正确方法是什么?

The s:Scroller is used by wrapping it around the content or DataGroup. s:Scroller通过将其包装在内容或数据组周围来使用。 But the List class wraps all that functionality inside of it's skin, so I believe that in order to create a custom Scroller for a List, you actually need to do within the SkinClass. 但是List类将所有这些功能包装在皮肤内部,因此我相信,要为List创建自定义Scroller,实际上需要在SkinClass中进行。

<list:InfiniteScrollList  width="100%" height="100%"  id="EventsList"
      useVirtualLayout="true" skinClass="MyListSkin" />

MyListSkin.mxml: MyListSkin.mxml:

<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
  xmlns:fb="http://ns.adobe.com/flashbuilder/2009" minWidth="112"> 

<fx:Metadata>
    [HostComponent("spark.components.Scroller")]
</fx:Metadata> 

<s:states>
    <s:State name="normal" />
    <s:State name="disabled" />
</s:states>


    <!-- The Scroller.as Class -->
    <list:Scroller left="0" top="0" right="0" bottom="0" id="scroller" hasFocusableChildren="false">
        <!--- @copy spark.components.SkinnableDataContainer#dataGroup -->
        <s:DataGroup id="dataGroup" itemRenderer="spark.skins.spark.DefaultItemRenderer">
            <s:layout>
                <!--- The default layout is vertical and measures at least for 5 rows.  
                When switching to a different layout, HorizontalLayout for example,
                make sure to adjust the minWidth, minHeight sizes of the skin -->
                <s:VerticalLayout gap="0" horizontalAlign="contentJustify" requestedMinRowCount="5" />
            </s:layout>
        </s:DataGroup>
    </list:Scroller/>
</s:SparkSkin>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM