Reputation: 668
I run through a few loops to build out a 32 x 32 block In my real example the colors vary but in testing, even simplified I am getting nowhere
var tempWidth:int = currentTileSel.width;
var tempHeight:int = currentTileSel.height;
var newbit:Bitmap = null;
var myBitmapData:BitmapData = new BitmapData(tempWidth, tempHeight,true,0x000000);
var drawCount:int = 0;
for(var i:int = 0; i< tempHeight; i++)
{
for(var j:int = 0; j < tempWidth; j++)
{
var setColor:uint = pixelArray[drawCount].colorfill;
myBitmapData.setPixel32(j,i,0x000000);
drawCount++;
}
}
///*
currentTileSel.graphics.clear();
currentTileSel.graphics.lineStyle(.25,0xCCCCCC,.5,false);
currentTileSel.graphics.beginBitmapFill(myBitmapData);
currentTileSel.graphics.drawRect(0,0,tempWidth,tempHeight);
currentTileSel.graphics.endFill();
currentTileSel.bitmapHolder = myBitmapData;
//*/
newbit = new Bitmap(myBitmapData);
gridLoader.addChild(newbit);
I would think this would produce a black bitmap pixel by pixel, but I get nothing on the bitmapFill and nothing when I add it to the screen as a bitmap.
What am I doing wrong? Thanks a lot in advance!
Upvotes: 0
Views: 97
Reputation: 1768
You are drawing transparent black pixels. Instead of 0x000000 it should be 0xff000000.
myBitmapData.setPixel32(j,i,0xff000000);
or use setPixel(x, y, color);
Upvotes: 1
Reputation: 539
Your problem is this line:
myBitmapData.setPixel32(j,i,0x000000);
Here, you are setting the transparency to 0. Try:
myBitmapData.setPixel32(j,i,0xFF000000);
Upvotes: 2