简体   繁体   English

ActionScript3,Adobe Air移动版:如何将图像放入IconItemRenderer中?

[英]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. 我正在尝试使用IconItemRenderer,但是,我无法弄清楚如何在IconItemRenderer中显示图像(spark.components.Image)。

I have tried the following: 我尝试了以下方法:
iir.iconContentLoader = image.contentLoader; iir.iconContentLoader = image.contentLoader;

But this did not work. 但这没有用。 The image is correct, when I use addElement(image) instead, it works. 该图像是正确的,当我改用addElement(image)时,它可以工作。

So, how can I add a dynamic image to an IconItemRenderer? 因此,如何将动态图像添加到IconItemRenderer?

You could try using the iconFunction property in the iconItemRenderer class as follows: 您可以尝试使用iconItemRenderer类中的iconFunction属性,如下所示:

iir.iconFunction = getImage;

...

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

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

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