flashactionscript-3flash-cs5scaletilelist

How to ScaleContent the image inside a TileList


im in Flash CS5.

I have a TileList that loads its images from an XML, not all the images are the same size so they do not llook consistent wiyh the TileList.

So i want the TileList to Scale the images it gets from the XML.

How can i do this?

Thank you for any help i received.


Solution

  • This should do what you want.

    img.addEventListener(Event.COMPLETE, onLoad )
    private function onLoad( e:Event ):void{
      var scale:Number = (targetHeight) / img.contentHeight;
      this.img.scaleX = scale;
      this.img.scaleY = scale;
    }