Dynamic _saturation, _brightness and _contrast in AS2

_sat _bri and _con using ColorMatrix

In my previous AS2 post I’ve explained how to dynamically adjust saturation on MovieClips using ColorMatrix. Most of you would also want to have the possibility to do the same on brightness and contrast params. I’ve prepared a small compilation of those three in one package - you can download it here

You could also combine all three and use them simultanously, it can be done easily - feel free to contact me if you have problems with that.

 FLAIM

MovieClip saturation Tweening using ColorMatrix and Tweener

saturation tweening

Here is a more complicated implementation of ColorMatrix Class in conjunction with Tweener in order to get a “_saturation” property of a MovieClip which can then be fully controlled by Tweener (used in this example) - or other Tweening engines.

Here is the sample code (you can download FLA example HERE):

import ColorMatrix;
import caurina.transitions.Tweener;
import flash.filters.ColorMatrixFilter;

MovieClip.prototype.addProperty(”_saturation”, this.getSAT, this.setSAT);
MovieClip.prototype.setSAT = function(sth)
{
 this._saturation = sth;
};
MovieClip.prototype.getSAT = function()
{
 return this._saturation;
};

example_mc._saturation=0;
example_mc.cm = new ColorMatrix();
example_mc.cm.adjustSaturation(example_mc._saturation-100);
example_mc.filters = [new ColorMatrixFilter(example_mc.cm)];

changeSAT = function(what)
{
 //the same as above but in form of a function executed on each Tweener UPDATE (onUpdate :)
 what.cm = new ColorMatrix();
 what.cm.adjustSaturation(what._saturation-100);
 what.filters = [new ColorMatrixFilter(what.cm)];
};

// ___________________USAGE

example_mc.onRollOver = function()
{
 Tweener.addTween(this,{_saturation:100,time:.4,transition:”easeOutSine”,onUpdate:changeSAT,onUpdateParams:[this]});
};
example_mc.onRollOut = function()
{
 Tweener.addTween(this,{_saturation:0,time:.4,transition:”easeOutSine”,onUpdate:changeSAT,onUpdateParams:[this]});
};

the full code available for download is fully commented - here

 FLAIM

Complex Gallery in Flash 8

Flaim photo gallery

 

I’ve decided to use and publish my latest version of a flash gallery as a private photo book - http://galeria.czytnik.com

The gallery uses some cool features:

 - ColorMatrix for _saturation and _contrast effects,

- Built in Tweening Class for image transitions and animations

- Stage (100%) with Stage.onResize

- Bitmap Filters and matrices for creating dynamic glass effects under photos

Feel free to comment the effort ;) I’ll include the sources soon so stay tuned. Maybe someone will need something like that in his own project/gallery.

 Have fun,

Flaim