» Are you looking for FLV Player?

ImageLoader class for Flash 8

17 August 2006 | filed under flash | 3 comments

ActionScript iconThis piece of code has been lying around for some time. I wrote it due to the fact that Flash 8 doesn’t smooth dynamically loaded images by default. This means that scaling and rotating any dynamically loaded image will make it look “jagged”.

The first (for as far as I know) to write Flash code to circumvent this issue was Master Tinic Uro himself; he is one of the engineers at Adobe working on the Flash Player. He wrote a handy function to load an image dynamically and then smooth it using a neat BitmapData / MovieClip trick

I wrapped his idea and some extras (events from MovieClipLoader class are relayed and the PNG transpareny solution is also included) in a single class I dubbed ImageLoader (duh).

Usage is as follows:

Actionscript:
  1. var loader:ImageLoader = new ImageLoader();
  2. loader.addListener(this);
  3. loader.loadImage( “some_image.jpg”, some_mc );

In the sample above, the ‘this’ context will receive all events normally fired by the MovieClipLoader class while loading an image.

ImageLoader smoothing

 

3 Responses to “ImageLoader class for Flash 8”

  1. Eliramalho says:

    Many thanks for sharing your work and effort.
    I also don’t like open flash to view flv files.

    Thanks and good job for you.

  2. Lîtus says:

    Thanks a lot for that piece of code. I’ve been searching some of this for two weeks ago. I also found some script for solve this problem (using class BitmapData), you can read about it in my blog (in spanish…).
    [http://www.evostudio.com/litus-host/litus-blog/lb_02/post.php?view_p_id=47]

    Bye!

  3. Luke says:

    Very useful piece of code, thanks for that.

    Only unfortunate issue is that it seems to slow Flash down a lot. Is this built into newer (9+) versions of the player, I remember Tinic mentioning a more native smoothing function?

Leave a Reply