samedi 9 mai 2015

Populating mxml with JSON data containing urls

I just started learning Flex today. I faced a problem. I have some JSON data returned from my webservice, like this:

[{"id":"34","url":"im3.png","uid":"1","pr":"1"},{"id":"33","url":"im2.jpg","uid":"1","pr":"0"},{"id":"32","url":"im1.jpg","uid":"1","pr":"1"}]

I can decode it and store in array which populates my DataGrid.

<mx:DataGrid id="prGallery" left="25" right="25" top="25" bottom="25" dataProvider="{prDB}">

prDB is intialized "on load".

Everything works fine but... I would like to display images out of those URLs (images are stored on my server under xxxxx.xx/url.

Storing tags like <img src="xxxxx.xx/url"/> obviously doesn't work. So here come my questions:

  1. Firstly, is it a good idea to use DataGrid for displaying images? (Even though I couldn't see the result I think it's not.)
  2. What other component should I use in order to populate it with unknown number of records. (rows contain both text and image).

Aucun commentaire:

Enregistrer un commentaire