tint color image to grayscale
- Started
- Last post
- 12 Responses
- armed_rob
...in flash player 7?
Is it possible to tint a movieclip holding a color image to grayscale?
Hope someone can help me out.
- fusionpixel0
with actionscript of manually?
- fusionpixel0
here is one way:
import flash.filters.BitmapFilter;
import flash.filters.ColorMatrixFilter;desaturation = 0;
this.onEnterFrame = function(){if(desaturation = 1){
des = -0.05;
}
desaturation += des;image_mc.filters = new Array(getDesaturationFilter(desa...
}function getDesaturationFilter(t:Number...
t = t != undefined ? t : 1;
var r = 0.212671;
var g = 0.715160;
var b = 0.072169;
return new ColorMatrixFilter(
[t*r+1-t, t*g, t*b, 0, 0,
t*r, t*g+1-t, t*b, 0, 0,
t*r, t*g, t*b+1-t, 0, 0,
0, 0, 0, 1, 0]);
}
- pski0
- armed_rob0
Buy script, Fusionpixel that script only works in Flash 8 right? Can it be done with flash 7 too?
- anayafx0
negative that script is flash8 only.
The image processing techniques are new in 8.
- armed_rob0
does that mean no color to grayscale script in flash 7?
- kyl30
good timing, I need to do this on monday
- CyBrain0
Nice script! I can't wait to start using Flash 8 AS2 on projects.
I'm going to try pski's suggestion of using laco's colorTo function. I'm assuming that's what he meant.
- CyBrain0
Well, the laco scripts have a tintTo method, but it's not much different fromt eh colorTo function.
Click the image to see what happens. Here's my script on frame 1 with theImage_mc on the stage.
Look here:
http://www.talesfromthehead.com/…#include "lmc_tween.as"
var isTinted:Boolean = false;
theImage_mc.onRelease = function() {
if (!isTinted) {
theImage_mc.tintTo(0x333333, 80, 3, "easeOutQuad");
isTinted = true;
} else {
theImage_mc.tintTo(0x333333, 0, 3, "easeOutQuad");
isTinted = false;
}
};
- armed_rob0
hmm... thats not grayscale like the 8 example. Maybe this should be the last project in flash 7?
thanks for the great help.
- kon230
this week ive had the opportunity to play around with some of the new features in flash for an actual job.
using the blur and saturation filters :) and no, it isnt just using it for the sake of using it - it has its purpose.
- kyl30
I tried using the features in flash 8 to do this very thing last week to no avail.