简体   繁体   中英

Actionscript3, Adobe Air for mobile: How to put an Image into an IconItemRenderer?

I want to display a list of dynamically generated images. I am trying to use an IconItemRenderer, however, I cannot figure out how to display the image (a spark.components.Image) in the IconItemRenderer.

I have tried the following:
iir.iconContentLoader = image.contentLoader;

But this did not work. The image is correct, when I use addElement(image) instead, it works.

So, how can I add a dynamic image to an IconItemRenderer?

You could try using the iconFunction property in the iconItemRenderer class as follows:

iir.iconFunction = getImage;

...

private function getImage(item:Object):* {
    return image.contentLoader;
}

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