I have been using this class for ages but I thought I’d share it with everyone. It does the following things that a conventional Loader class does not:

- Automatic scaling
- Bitmap smoothing (for custom scales)
- PNG transparency
- Graceful error control (black box for when the image fails to load)

Working with the Loader class on images can be tedious as it doesn’t really behave the way we expect it to, so I created this class to handle everything automatically.

The usage is simple:


var image:Image = new Image(0,0) // Use numbers for the x, y dimensions to force the image to a specific size or aspect ratio. 0,0 uses the default image size when loaded.
image.addEventListener(Event.INIT, _imageInitialized); // Make this callback whatever you'd like, although it's not necessary.
image.load("http://www.mysite.com/myimage.png");

You can download the source code to the class here:
Image Class