# Resize Sprite

**URL:** <https://forum.kirupa.com/t/resize-sprite/238712>\
**Category:** flash\
**Created:** [September 14, 2007, 5:17am UTC](https://forum.kirupa.com/t/resize-sprite/238712 "2007-09-14T05:17:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![endemoniada](https://avatars.discourse-cdn.com/v4/letter/e/dec6dc/32.png) [@endemoniada](https://forum.kirupa.com/u/endemoniada)\
**Post date:** [September 14, 2007, 5:17am UTC](https://forum.kirupa.com/t/resize-sprite/238712/1 "2007-09-14T05:17:09Z")

</div>

Hi guys,

I have a class that extends Sprite, in the constructor I do this:

surface=new BitmapData(100,100,true,0x00000000);  
bitmap=new Bitmap(surface);  
addChild(bitmap);

…so now I can use surface.copyPixels() for some fast blitting.

The thing is, I want to resize the whole thing dynamically.

This seems to work fine but is it safe ?

bitmap.bitmapData=new BitmapData(200,200,true,0x00000000);

…can I keep doing that ? I’m use to C(++) so it seems unsafe.

Also, it will not work if I replace bitmap.bitmapData with surface, like so:

surface=new BitmapData(200,200,true,0x00000000);

…which I don’t understand. Any help would be appreciated.

Thanks.
