简体   繁体   中英

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? 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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