# Copy visible pixels of 2 Sprites

**URL:** <https://forum.kirupa.com/t/copy-visible-pixels-of-2-sprites/247021>\
**Category:** flash\
**Created:** [December 17, 2007, 8:19pm UTC](https://forum.kirupa.com/t/copy-visible-pixels-of-2-sprites/247021 "2007-12-17T20:19:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blaatorx](https://avatars.discourse-cdn.com/v4/letter/b/f17d59/32.png) [@blaatorx](https://forum.kirupa.com/u/blaatorx)\
**Post date:** [December 17, 2007, 8:19pm UTC](https://forum.kirupa.com/t/copy-visible-pixels-of-2-sprites/247021/1 "2007-12-17T20:19:55Z")

</div>

Peepz,

I want to copy the visible pixels of 2 sprites whitin a new Sprite.  
The top Sprite is transparent in the middle so i have to see the sprite beneath it.  
But the middle is always white and not transparent can somebody help?

```auto

function cloneBitmap(myOldClip:Sprite, myNewClip:Sprite):void
{
 var myBitmapData:BitmapData = new BitmapData(myOldClip.width - 1, myOldClip.height - 1, true);
 myBitmapData.draw(myOldClip) 
 
 var bmp:Bitmap = new Bitmap(myBitmapData); 
 myNewClip.addChild(bmp);
}

```
