I’m trying to use a bitmap fill, but I can’t seem to get it to work.
I’m using FlashDevelop with assets imported from CS4 - this isn’t the problem, I can instantiate the asset I’m targeting perfectly fine, so I suspect that it’s a problem with what I’m trying to do.
Here’s my code:
//get the bitmap data from a grass symbol
//grass symbol IS present - can be added to stage fine
var grassBMD:BitmapData = new BitmapData(155, 80);
grassBMD.draw(new Grass());
//style the line (this works fine)
this.graphics.lineStyle(.25, 0xCCCCCC, 1, true);
//try bitmap fill using the bitmap data from earlier
this.graphics.beginBitmapFill(grassBMD);
//draw the box (slanted) using the drawing API
//I think this is why it doesn't work - instead of using a primitive shape, i'm using lines
this.graphics.moveTo(0, 0);
this.graphics.lineTo( -SIZE, SIZE / 2 );
this.graphics.lineTo( 0, SIZE );
this.graphics.lineTo( SIZE, SIZE / 2 );
this.graphics.lineTo( 0, 0 );
//end fill
this.graphics.endFill();
I’m not really sure what’s going on. Nothing gets displayed in the box, so I’m suspicious that I’m not allowed to use bitmap fill in non-primitive shapes. Any ideas are greatly appreciated