Hi. I am trying to finally get my head around bitmapdata and filters. I have made a simple flash that has a movieclip of a circle in the library. I add it to the stage and then make it follow the mouse. Then i use it to draw to a bitmap and then apply a blur. The problem is that the blur doesn’t become transparent, and eventually fills the whole screen. I’ve tried using a colorTransform and a ColorMatrixFilter but they don’t seem to work.
Here’s the code. What i really want is the blur to gradually become transparent towards the edges, in the way a gaussian blur would work in PS.
var bmd:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0xFFFFFF);
var bm:Bitmap = new Bitmap(bmd);
addChild (bm);
var bf:BlurFilter = new BlurFilter(6,6,1);
/*var cmf:ColorMatrixFilter = new ColorMatrixFilter([0.9,0,0,0,0,
0,0.9,0,0,0,
0,0,0.9,0,0,
0,0,0,0.6,0]);*/
var cTransform:ColorTransform = new ColorTransform();
cTransform.alphaMultiplier = 0.65;
var gfx:bmGraphic = new bmGraphic();
addChild(gfx);
this.addEventListener(Event.ENTER_FRAME, frameHandler);
function frameHandler(e:Event):void{
gfx.x = stage.mouseX - (gfx.width/2);
gfx.y = stage.mouseY - (gfx.width/2);
bmd.colorTransform(bmd.rect, cTransform);
bmd.applyFilter(bmd, bmd.rect, new Point(0,0), bf);
bmd.draw(this);
}
If anyone can help me that would be great. I feel like i’m missing the point here.
edit: Oops. Thought i was in the as3 section … sorry.