2 Replies Latest reply on Apr 25, 2010 10:59 AM by jimmyoneshot

    SetItemAt Not Updating Tilelist Icons Correctly

    jimmyoneshot Level 1

      My app allows users to enter in a url a title and an image filename and then when they click a button a snapshot of this url is created and sent to the server as the filename they have entered and an item containing all this data is added to an array collection which displays all this within a tilelist, the item renderer is linked to the server which contains the images (via the i) so they are displayed within the tilelist. The thing is this I'm trying to allow my users to update these things using the setitemat method i.e. they click on an item and all it's data is displayed and they can edit it and then save it which will use the setitemat function to update this item in the array collection.

       

      My problem is this, if the user changes the url it takes a snapshot of this new url to overwrite the previous image on the server but if they keep the image filename the same it doesn't seem to refresh within the tilelist itself. I know the image on the server has been overwritten as the image on the server in question has been changed when I check it but for some reason the image in the tilelist isn't updating to the new image. It's as if flex has the old image stored in memory or something and won't switch to the new one. Is this common and is there anyway around this besides refreshing the whole array collection each time the user updates an item. Is there any way of refreshing only the item that has just been updated perhaps? The strange thing is if the user enters a different image filename.

       

      Here's the line of code which updates the selected item (with 'a' being the chosen item in the tilelist):-

       

      ArrayCollection(linkChoice.dataProvider).setItemAt({linkid:linkChoice.selectedItem.linkid, categoryid:updatedcategoryid, label:updatedlabelentry.text, icon:updatediconentry.text, url:updatedurlentry.text}, a);

        • 1. Re: SetItemAt Not Updating Tilelist Icons Correctly
          Flex harUI Adobe Employee

          Could be in the browser cache.  Often folks append a fake url param to the

          url

          1 person found this helpful
          • 2. Re: SetItemAt Not Updating Tilelist Icons Correctly
            jimmyoneshot Level 1

            Yes but that's the thing. People can't enter a fake url because the process all takes place right in front of them and shows the site they are about to take a snapshot of. Plus I've tested it myself and looked on the server and the images are there and can be linked to elsewhere but it just seems that the tilelist images aren't updating to that new image when the user enters a filename which is the same as the current one. It's almost like having the same filename is confusing flex and making the tilelist still display an image that is now different and has been overwritten.

             

            All my data is dynamic and is loaded at startup into the tilelist array collection data provider and then the user can edit it. My tilelist has an item renderer containing an image the code for which is this:-

             

             

             

            <mx:Image source="{'http://www.mysitename.com/images/'+data.icon+'.jpg'}" height="100" width="100"/>

             

            And obviously the user can rename the icon property as the place on my site where the new image gets uploaded to but if they keep the name the same the image doesn't refresh. If they edit the name then it does change correctly once it's been added I've been racking my brains trying to figure it out.

             

            The strange thing is this. I have a filter function applied to my tilelist which changes the contenrt based on what category a user selects at the top of the app. If a user selects a category and selects a link and edits the image to  a different one but saves it as the same filename that it already was it doesn't show the new image in the tilelist BUT if they then click to another category that has other images in it and then go back to the category they edited the link in all of a sudden it has changed. I'm totally confused about this.