1 Reply Latest reply on Mar 1, 2011 9:20 PM by Shongrunden

    MobileIconItemRenderer dont display icon

    mushmut Level 1

      Hi,

       

      In a flex mobile Project, i use a list with a custom MobileIconItemRenderer. But it's never display the icon. I've also try to load picture content via the iconContentLoader and listening the complete event, but the picture still invisible. However, the labelField and the message are displayed as expected.

       

      I post my overrided set data function

       

      override public function set data(value:Object):void {
      
          
      _data = new XML (value);
      var fieldObject:Object = new Object()
      fieldObject.icon = _data.image
      fieldObject.title = _data.title
      fieldObject.hat = _data.hat
      super.data = fieldObject;
      iconField = "icon";
      labelField = "title";
      messageField = "hat";
      decoratorClass = EmbedManager.LIST_ARROW
      
      iconHeight = 100;
      iconWidth = 100;
      
      
      }
      
      

       

      Thank in advance

        • 1. Re: MobileIconItemRenderer dont display icon
          Shongrunden Adobe Employee

          Hard to tell without the full renderer code, but this example seems to work for me in the latest Hero prerelease build:

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                         xmlns:s="library://ns.adobe.com/flex/spark" >

           

              <s:List width="100%" height="100%">

                  <s:itemRenderer>

                      <fx:Component>

                          <s:IconItemRenderer>

                              <fx:Script>

                                  <![CDATA[

                                      override public function set data(value:Object):void {

                                          super.data = value;

                                          iconField = "productIcon";

                                          labelField = "productName";

                                          messageField = "productDesc";

                                          iconHeight = 100;

                                          iconWidth = 100;

                                      }

                                  ]]>

                              </fx:Script>

                          </s:IconItemRenderer>

                      </fx:Component>

                  </s:itemRenderer>

                  <s:dataProvider>

                      <s:ArrayList>

                          <fx:Object productIcon="assets/fx.jpg" productName="Flex SDK"

                                     productDesc="A highly productive, free, open source framework."/>

                          <fx:Object productIcon="assets/fb.jpg" productName="Flash Builder"

                                     productDesc="Designed to help developers rapidly develop RIAs."/>

                          <fx:Object productIcon="assets/fc.jpg" productName="Flash Catalyst"

                                     productDesc="An approachable new interaction design tool."/>

                      </s:ArrayList>

                  </s:dataProvider>

              </s:List>

           

          </s:Application>

           

          Note: MobileIconItemRenderer has been renamed to IconItemRenderer since the MAX prerelease build.  You should apply to get into the Hero prerelease program to get the latest build.  There are many improvements to IconItemRenderer and the feel and performance of scrolling.