0

我正在使用 IconItemRenderer 的装饰器属性嵌入图像。但是图像很大,我想将图像的高度和宽度设置为更小的尺寸。我尝试过使用 iconHeight 和 iconWidth 属性。但这不起作用。我是flex的初学者。有人可以帮帮我吗?PFB代码,

<s:List id="list" top="0" bottom="0" left="0" right="0" dataProvider="{srv.lastResult.data.employee}">
    <s:itemRenderer>
        <fx:Component>              
<s:IconItemRenderer  label="{data.empName}" decorator="@Embed('../small/empImage.jpg')" iconHeight="1" iconWidth="1"  >
                </s:IconItemRenderer>
            </fx:Component>

        </s:itemRenderer>

        </s:List>
4

1 回答 1

0

我认为 iconField 属性是您正在寻找的

    <?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               creationComplete="creationCompleteHandler(event)"
               xmlns:mx="library://ns.adobe.com/flex/mx">
    <s:List id="list"
            top="0"
            bottom="0"
            left="0"
            right="0"
            dataProvider='{dataProvider}'>
        <s:itemRenderer>
            <fx:Component>
                <s:IconItemRenderer iconField="image"
                                    iconHeight="50"
                                    iconWidth="50"/>
            </fx:Component>
        </s:itemRenderer>
    </s:List>
    <fx:Script><![CDATA[
        import mx.collections.ArrayCollection;
        import mx.collections.IList;
        import mx.events.FlexEvent;

        private var dataProvider:IList = new ArrayCollection();

        private function creationCompleteHandler(event:FlexEvent):void {
            var object:Object = new Object();
            object.empName = 'hello';
            object.image = 'http://theadvancedapes.com/wp-content/uploads/2013/10/logo-google-astro-1.jpg'
            dataProvider.addItem(object)
            var object:Object = new Object();
            object.empName = 'hello';
            object.image = 'http://theadvancedapes.com/wp-content/uploads/2013/10/logo-google-astro-1.jpg'
            dataProvider.addItem(object)
        }
        ]]></fx:Script>
</s:Application>
于 2013-11-13T17:20:25.103 回答