BitmapData Threshold Explorer

The threshold function of the BitmapData object in Flash 8 (and 9) is one of its most powerful features, and one of the most confusing.

For my FiTC I presentation, I had created a Noise Explorer and a Perlin Explorer, which I thought were pretty cool. So I decided to do the same for the threshold function. And here it is:

This was a lot more complex, as I made it so you can load in your own bitmap to play with. Problem with that is when you load in a bitmap from another domain, you aren’t allowed to draw its pixels onto a BitmapData object. Bah! Security! Until I figure out a workaround, I had to make it a projector, which seems to not really care about that limitation. So here they are:

Threshold Explorer for Windows

Threshold Explorer for Mac

This explorer doesn’t show every possible usage of threshold. In particular, it limits your mask choices to full red, green, or blue channels, and pretty much ignores the concept of the alpha channel all together. But it definitely simplifies the usage of the function and will cover 90% of your use cases, and allow you to easily extrapolate most of your remaining use cases.

This entry was posted in General. Bookmark the permalink.

2 Responses to BitmapData Threshold Explorer

  1. Antares says:

    hola, estoy haciendo unos experimentos con la funcion threshold() de flash y me gustarĂ­a saber como as conseguido cargar imagenes dinamicas. A mi no me permite cargarlas y usarlas con la funcion.
    mi codigo de ejemplo es:

    import flash.display.BitmapData;
    this.createEmptyMovieClip("holder_mc", this.getNextHighestDepth());
    loader = new MovieClipLoader();
    loader.addListener(this);
    loader.loadClip("file:///C|/DOCUME%7E1/image2.jpg", holder_mc);
    function onLoadInit() {
    myBitmap = new BitmapData(holder_mc._width, holder_mc._height, true, 0x00FFFFFF);
    myBitmap.draw(holder_mc);
    myBitmap.threshold(holder_mc, new Rectangle(0, 0, 100, 40), new Point(0, 0), ">=", 0x00CCCCCC, 0x000000FF, 0x0000FF00, false);
    }

  2. Chris says:

    Seems to not be working on my Mac. You should throw me the source code and I’ll compile it into an AIR app for you or something.

Leave a Reply