我在将 ByteArray 图像设置为 IconItemRenderer 中的“iconField”时遇到问题。我想我在使用“iconFunction”方面已经完成了一半,但是我应该调用什么来在“iconField”中设置图像?
请帮忙!先感谢您。
<s:IconItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
iconFunction="initializeIcon"
iconWidth="45"
iconHeight="45">
<fx:Script>
<![CDATA[
import mx.utils.Base64Decoder;
private function initializeIcon(data:Object):void
{
var imageName:String = data.image; //image is Base64 encoded data from a dynamic array
var byteArr:ByteArray;
var base64Dec:Base64Decoder = new Base64Decoder();
base64Dec.decode(imageName);
byteArr = base64Dec.toByteArray();
//set iconField? what should I do from here on.
}
]]>
</fx:Script>
</s:IconItemRenderer>