# How to copy a bitmap data and store as a global variable

**URL:** <https://forum.kirupa.com/t/how-to-copy-a-bitmap-data-and-store-as-a-global-variable/311083>\
**Category:** flash\
**Created:** [June 27, 2010, 8:56am UTC](https://forum.kirupa.com/t/how-to-copy-a-bitmap-data-and-store-as-a-global-variable/311083 "2010-06-27T08:56:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sasukexkun](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@sasukexkun](https://forum.kirupa.com/u/sasukexkun)\
**Post date:** [June 27, 2010, 8:56am UTC](https://forum.kirupa.com/t/how-to-copy-a-bitmap-data-and-store-as-a-global-variable/311083/1 "2010-06-27T08:56:53Z")

</div>

Hi all, i am having problem to recall the copied bitmap data to show on another private function which is difference from the private function which copy the bitmap process.

:stormtrooper:i am new in AS3 so have no idea how do i make the copied bitmap data into a global variable…

heres my sniplet of code:-

private function export():void  
{  
var bmd:BitmapData = new BitmapData(216.2, 468.29);

```
                var a_matrix : Matrix = new Matrix() ;
                a_matrix.translate(-242,-130);
                bmd.draw(stage,a_matrix);
                
                var screenshot:Bitmap = new Bitmap(bmd);
                screenshot.x = 0;
                screenshot.y = 0;
                //var screen shot is the copied image 
              }

```

private function showCopiedImage():void  
{  
addChild(screenshot); // won’t work because it is null.  
}

this is the problem i am facing, i need to seperate the copying process and showing process because i want my flash to show the copied image later on…

Seriously need help . Thanks i advance ☹
