简体   繁体   English

Flex项目渲染器-闪烁图像

[英]Flex item renderer - blink image

I have a List with his ItemRenderer, all right, when I send the data to dataprovider, this enter in the function 'set data' (override), I have there two images and one label, when the data is sent then I check if the image have the source that will set, if this item has that source, then I don't set the source for avoid a blink effect, but it is not working, why? 我有一个带有他的ItemRenderer的列表,好吧,当我将数据发送到dataprovider时,在函数“设置数据”中输入(覆盖),我有两个图像和一个标签,当发送数据时,我检查是否图像具有要设置的源,如果该项目具有该源,那么我没有设置源来避免眨眼效果,但是它不起作用,为什么? in the condition I check the source of image and this is null. 在这种情况下,我检查图像的来源,这是空的。

Source: 资源:

override public function set data( _data:Object ) : void {
    if (imgStatusMessage.source != _data.source) {
        imgStatusMessage.source = _data.source;
    }
}

... ...

<s:Image id="imgStatusMessage" width="15" height="15" visible="false"/>

Then, when item is 'repaint' check property of this element, if have the same value of _data var, then don't set the value again. 然后,当item为'repaint'时,检查此元素的属性,如果_data var具有相同的值,则不要再次设置该值。

EDIT: if more data is sent, all item work good, except first item; 编辑:如果发送了更多数据,则除第一项外,所有项均工作正常; only the first item have this problem of blink in one of the images. 仅第一项在一个图像中出现眨眼问题。

You can add this to your list definition(it will switch off renderers' recycling): 您可以将其添加到列表定义中(它将关闭渲染器的回收):

<s:List>
   <s:layout>
      <s:VerticalLayout useVirtualLayout="false" />
   </s:layout>
</s:list>

and see if problem persists. 看看问题是否仍然存在。

If no, you can leave it like that, but it may influense app's performance for large lists. 如果没有,您可以像这样保留它,但是它可能会影响大型列表的应用性能。 Otherwise, you may imlement your renderer in such way that it will not set source again, but instead will add already-made image from some pre-made collection, especially if 'source' is an url and not embedded BitmapAsset. 否则,您可能会以某种方式实施渲染器,使其不再设置source ,而是从某些预制集合中添加已制成的图像,尤其是如果“源”是URL而不是嵌入的BitmapAsset。

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

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