Welcome, Guest
Want to take part in these discussions? Sign in if you have an account, or apply for one below
-
- CommentAuthorAAD
- CommentTimeMar 23rd 2011
I've been toying with Flash as3 and FLINT - I'm not a coder by any standard but I've been patching bits and pieces of what I find to make some things work.
I'm trying to create a fluid effect by blurring particles and then using threshold on the blurred data. My question is what data I should be using. I want to have my compare image be a black background ( I think I got it) but what would the bitmapdata be from the particles be? I tried to use the bitmaprenderer but that wasn't right. below is the relevant (I think) part of the code:
var renderer:BitmapRenderer = new BitmapRenderer(new Rectangle( 0, 0, 800, 600 ));
renderer.addFilter( new BlurFilter( 20, 20, 5 ) );
renderer.addEmitter( emitter );
var bmd1:BitmapData = new BitmapData(400, 400, true, 0xFFCCCCCC);
var pt:Point = new Point(0, 0);
renderer.threshold(bmd1, bmd1.rect, pt, ">", 0XFF2b2b2b, 0x55FFFFFF, 0xFFFFFFFF, false);
Basically, for the last line instead of renderer.threshold what should it be? -
- CommentAuthorAAD
- CommentTimeMar 27th 2011
When I try it I get the error:
1061: Call to a possibly undefined method threshold through a reference with static type Class.
Clearly the renderer isn't the bitmapdata, but I'm not sure how (or if) Flint exports the data (specifically bitmap data, as I am using the BitmapRenderer).
Thanks in advance. -
- CommentAuthorRichard
- CommentTimeApr 3rd 2011 edited
The BitmapRenderer has a bitmapData property. That's the bitmap data of the renderer. -
- CommentAuthorAAD
- CommentTimeApr 4th 2011
Ah ok. Thank you. Still having a bit of trouble though. What I have thus far:
var renderer:BitmapRenderer = new BitmapRenderer(new Rectangle( 0, 0, 800, 600 ));
renderer.addFilter( new BlurFilter( 20, 20, 5 ) );
renderer.addEmitter( emitter );
var point:Point=new Point(0,0);
var bd:BitmapRenderer;
bd.bitmapData();
var bd2:BitmapData;
bd2.fillRect(rect, 0x00000000);
bd2.threshold(bd, rect, point, ">", 155/255*0xffffff, 0x8C8C8C8C, 0x00ffffff, false);
The error I'm getting (2 of them):
For the line bd.bitmapData();
1195: Attempted access of inaccessible method bitmapData through a reference with static type org.flintparticles.twoD.renderers:BitmapRenderer.
and for the threshold line:
1067: Implicit coercion of a value of type org.flintparticles.twoD.renderers:BitmapRenderer to an unrelated type flash.display:BitmapData.
Am I not accessing the data properly?
Again, thanks. -
- CommentAuthorRichard
- CommentTimeApr 20th 2011
bitmapData is a property, and you're calling it like it's a method.
First, you need to instantiate the bd variable. At the moment it's null.
Then to access its bitmapData property, use bd.bitmapData - no parenthesis.
So in the threshold line, use bd.bitmapData, not bd.
1 to 5 of 5
