1 Reply Latest reply on Jul 21, 2006 8:31 AM by j8kel

    thumbnail with dynamic images

    j8kel
      I'm trying to create a thumbnail object for an HLIST, the data for the thumbnail is a bytearray containing an image in PNG format. The data comes from a database in an AMF object via FDS. I can see the data in the debugger, and it is not null, but I'm not sure what to do with it now that I have it. (ie, how to turn it into an image that I can display) Any help would be greatly appreciated.

      Thanks.
        • 1. Re: thumbnail with dynamic images
          j8kel Level 1
          So I've found something that "works", but I no longer get mouseover highlights or the ability to click the items. I'll post what I've got, and any suggestions/criticisms would be appreciated. Thanks

          ps, sorry I couldn't get the indenting to work properly




          public class ThumbRenderer extends Image {

          public var thumbLoader:Loader;
          // Define the constructor and set properties.
          public function ThumbRenderer() {
          //trace("thumbrenderer created");
          height=140;
          width=140;
          setStyle("borderStyle", "none");
          thumbLoader = new Loader();
          thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
          }

          override public function set data(value:Object):void {
          //trace("thumbrenderer set data");
          if(this.numChildren > 0)
          this.removeChildAt(0);
          var myData:ByteArray = File(value).imageData;
          thumbLoader.loadBytes(myData);
          }

          private function completeHandler(event:Event):void {
          trace("completeHandler: " + event);
          //super.data = thumbLoader;
          addChild(thumbLoader);
          super.invalidateDisplayList();
          super.invalidateProperties();
          super.invalidateSize();

          }

          }