Peepz,
I have a sprite that holds an image. over the image i generate some clips the i add on top of the image (with a for loop):
now i want to copy the visible pixels within the small clips (with the data of the image also) so i can remove the image and add al the seperate clips instead of the image.
i tried some, but the new Bitmap that the function is returning is black, i’m calling the function out af an for loop:
for(var i:int = 0; i<maskTotal; i++)
{
mcMask = new ScreenOverlay()
mcMask.name = "mcMask" + i
if(i%Width == 0 && i != 0)
{
yPos += mcMask.height// + screenYSpace
xPos = mcMaskImage.x
}
mcMask.x = xPos
mcMask.y = yPos
xPos += mcMask.width// + screenXSpace;
mcMask.mcOverlay.alpha = .17
activeContainer.addChild(mcMask) // the image is on INDEX "0" here
var myNewImage:Bitmap = copyMyPixels(mcMask)
addChild(myNewImage)
myNewImage.x = 200
myNewImage.y = 200
}
fnction for copypixels
function copyMyPixels(myMask:Object):Bitmap
{
var bmd1:BitmapData = new BitmapData(myMask.width, myMask.height, true);
var bmd2:BitmapData = new BitmapData(myMask.width, myMask.height, true)
bmd2.copyPixels(bmd1, new Rectangle(myMask.x, myMask.y, myMask.width, myMask.height), new Point(myMask.x, myMask.y));
var myNewSprite:Bitmap = new Bitmap(bmd2)
return myNewSprite
}