0 Replies Latest reply on Dec 7, 2011 4:11 PM by bcsearle

    mobile IconItemRenderer broken for iconFields?

    bcsearle

      I have a mobile application needing IconItemRenderer to list a bunch of lines,

      each with their own icon (depending on some item state), which is exactly what IconItemRenderer is designed for.

       

      1) in the itemRenderer, i can define a right-hand decorator icon (but it is always the same for every line):

                    decorator="@Embed(source='icons/xyz.png')"/>

      - -  that works in desktop and Mobile application

      2) I can add dataProvider items to the list, defining thier *individual* left-hand icon and label:

                    myCollection.addItem( {"name":"someText" ,"image":"@Embed(source='icons/xyz.png')" } );

       

      -- that displays properly in desktop SWT *if* the icon is

                   "icons/xyz.png"

      -- but *not* if the icon is

                   "@Embed(source='icons/xyz.png')"

      -- and no format works for mobile SWT

       

      3a) i found an adobe help example, but all it has for mobile IconItemRenderer is DECORATORS

      http://help.adobe.com/en_US/flex/using/WSc2368ca491e3ff92-1483ec4a12136246e76-8000.html#WS 77c1dbb1bd80d3836663fb6012af31eb8a5-8000

      -- conspicuous by its absence is setting the icon field, which is fundamentally why one would use the IconItemRenderer.

       

      WHAT GIVES?  does adobe know that this function is broken?

      How do i get the Item Icons defined and embedded into a MOBILE SWT ??

      - I am using production Flex SDK 4.5.1, and AIR 3.1 on Windows and Android

       

      ADDENDUM:

      4) *if* i store my list items in a static definition, the icons display correctly on mobile+desktop:

        <s:dataProvider> <s:ArrayList>

            <fx:Object name="aaa bbb" image="@Embed('icons/ON.gif')" />

            <fx:Object name="ccc ddd" image="@Embed('icons/OFF.gif')" />

         </s:ArrayList> </s:dataProvider>

      5) but as noted above, in the real world i need to dynamically build the list contents and *the* it does not work

           myDataCollection.addItem( { "name" : "eee fff", "image : "@Embed('icons/ON.gif')" } );

           myDataCollection.addItem( { "name" : "ggg hhh", "image : "@Embed('icons/ON.gif')" } );

      SOLUTION / WORKAROUND:

      The *only* way to get the mobile icon to work, also mantains desktop icon working:

           [Embed("icons/ON.gif")]

           public var onImgCls:Class;

           ...

           var icn:Class = offImgCls;

           myDataColl.addItem( {"name":line.substr(0,99), "image":icn} );