代码之家  ›  专栏  ›  技术社区  ›  Tam

在flex中对列表组件内的图像进行Scolling时会出现奇怪的显示

  •  0
  • Tam  · 技术社区  · 16 年前

    我有一个列表,可以显示类似的照片:

                 <s:List id="thumnPhotosList" 
                         dataProvider="{_model.photoAlbumToCreate.photos}"
                         height="450"
                         itemRenderer="PhotoRenderer" >
                     <s:layout>
                         <s:TileLayout orientation="columns"
                                       requestedRowCount="4"
                                       requestedColumnCount="3" />
                     </s:layout>
                 </s:List>
    

    光渲染器有这样的代码:

    ......
    
    <mx:Image source="{_model.url + theAlbumPhoto.thumbPhotoURL}"
                              visible="{theAlbumPhoto.ready}"
                              maintainAspectRatio="true"
                              maxWidth="{Constants.DEFAULT_ALBUM_PHOTO_WIDTH}" maxHeight="{Constants.DEFAULT_ALBUM_PHOTO_HEIGHT}" />    
    
    ........
    

    它工作得很好,除非当照片的数量越来越高并且滚动条出现时,它开始表现出奇怪的行为:它开始显示不同于它应该显示的照片,如果我向后滚动到开始并再次滚动到新的照片,其他的照片有时会显示正确的照片,有时不会。不知道怎么解决这个问题,有什么想法吗?您还可以推荐不同于使用s:list的方法,如果这样做更容易的话。

    3 回复  |  直到 16 年前
        1
  •  0
  •   seismael    16 年前

    我对文本列表也有同样的问题,我认为它的填充问题,为它可能帮助的所有组件组织填充。

        2
  •  0
  •   Tam    16 年前

    因为我不知道问题是什么,也无法在独立的应用程序上复制它。我想出了以下代码来解决这个问题:

                 <s:Scroller id="photoScroller"
                             width="100%"
                             visible="{_model.photoAlbumToCreateOrUpdate.photos.length > 0}"
                             horizontalScrollPolicy="off" verticalScrollPolicy="auto"
                             skinClass="com.lal.skins.PhotoAlbumScrollerSkin"
                             top="50" bottom="0"> 
    
                         <s:DataGroup id="thumnPhotosList"
                                      dataProvider="{_model.photoAlbumToCreateOrUpdate.photos}"
                                      itemRenderer="AlbumPhotoThumbRenderer" >
                             <s:layout>
                                 <s:TileLayout orientation="rows"
                                               requestedRowCount="4"
                                               requestedColumnCount="4" />
                             </s:layout>
                         </s:DataGroup>
                 </s:Scroller>
    
        3
  •  0
  •   orlade    16 年前

    我在TilleList中使用的自定义项呈现器中的图像组件也有同样的问题。我在不知道如何修复的情况下修复了它,但问题在于项渲染器中图像组件的源属性。

    项目呈现器的想法是使用 data 用于访问提供渲染器的项的变量。怎么办? _model 和 theAlbumPhoto 渲染器中引用的变量?我最终做的是将源属性改成更像 data.image_path 决定开始工作。

    如果你对你的解决方案满意,希望这至少能对其他人有所帮助。

    推荐文章