4 Replies Latest reply on Apr 23, 2008 7:05 AM by alex-party

    TileList redraw bug?

    alex-party
      Hi folks,
      Is there any known bug with the TileList component?
      Basically, I display thumbnails in the TileList component with custom itemRenderer and It seems like after updating ArrayCollection with new values, it receives values OK, but wont update the actual images.
      Thank you in advance,
      Alex

        • 1. Re: TileList redraw bug?
          pashe
          I'm having this problem as well. I have a bunch of thumbnails in TileList that when i update the array and select a new set of thumbnails they do not refresh with the correct set (the old thumbnails remain) but if I click on one of the result thumbnails i do get the details for the updated (correct) image.

          So like above it seems to receive all values ok but the thumbnail set does not update.

          Anyone know what might be causing this?

          Thanks in advance

          Paul

          • 2. TileList redraw bug?
            alex-party Level 1
            To reproduce the mentioned above problem, here is short example:

            <mx:Application ... creationComplete="srv.send()">
            <mx:Script>
            <![CDATA[
            [Bindable] public var imgs:ArrayCollection;
            [Bindable] public var _url:String=" http://...../vars.php";

            private function srv_result(evt:ResultEvent):void {
            imgs=evt.result.start.imgs.image;
            }

            ######### 1. lets say user pressed a button and invoked this function, which populates new values into IMGS array, but images won't update in TileList component
            public function xgo(name:String):void{
            srv.url=_url+'?name='+name;
            srv.send();
            }

            ]]>
            </mx:Script>

            <mx:HTTPService id="srv" url="{_url}" result="srv_result(event)"/>
            <mx:TileList dataProvider="{imgs}" itemRenderer="views.xImg" />

            </mx:Application>
            • 3. Re: TileList redraw bug?
              alex-party Level 1
              After digging more into code, I've found, that my itemRenderer component have been loading images on "initialize" event once, then when ArrayCollection changes, there is no "initialize" event happening anymore, that's why images are not updating, so is there any way I could add event listener on TileList or itemRenderer to trigger initialize event once more or force redraw it after ArrayCollection changed?

              =========== itemRenderer component ================
              <mx:Canvas initialize="init()">
              <mx:Script>
              <![CDATA[
              private function init():void{
              var request:URLRequest = new URLRequest( 'assets/gallery/small/'+data.filename+'.jpg' );
              var loader:Loader = new Loader();
              loader.contentLoaderInfo.addEventListener( Event.COMPLETE, cropImage );
              loader.load( request );
              }
              private function cropImage(event : Event):void{
              ....croping image here and loading into x_img.source.....
              }
              </mx:Script>
              <mx:Image id="x_img" x="5" y="3"/>

              </mx:Canvas>

              Thanks,
              Alex
              • 4. Re: TileList redraw bug?
                alex-party Level 1
                Well, thank you all, but I found a solution to this problem myself and it seems to be working. All I had to do is add dataChange event to the itemRenderer component, like that:

                =========== itemRenderer component ================
                <mx:Canvas dataChange="init()">

                I hope this will help someone,
                Regards,
                Alex