1 Reply Latest reply on Feb 20, 2010 12:27 AM by Andrei Stoleru

    How to create a background image for each item in a List object




      I am trying to create a background image that displays whenever a user posts something to a list.  For example when a user posts text it would appear in a list.  The new item in the list would contain a specific background image with the users text appearing on top of the background image.  I do not want a background image for the entire list, rather each item within the list.


      I am not sure how clear this is so I added an image below.  When a user enters text in and clicks the "post-it" button their text would appear below with the sticky note background. 


      I am not sure which list type would be best for this problem or how to create insert the image, so I am open to suggestions. 


      Thank you for your help.  Any advice or guidance will be greatly appreciated!



      list img.png

        • 1. Re: How to create a background image for each item in a List object
          Andrei Stoleru



          the easiest way would be with itemRenderer.

          You have to do two things:


          1. In your list declaration use a item renderer: <mx:List itemRenderer="myRenderer"/>

          2. create a flex component myRenderer that will be the single item. This can be a canvas with a background image and a text field on it.


          When you add a new item to the list, a new myRenderer item will be created and the data property will be passed to it. So you have to put "data" in your textField.

          If you need more help try looking at Tour de Flex samples, they're pretty easy.