# \[AS3\]Splitting bitmapData into tiles

**URL:** <https://forum.kirupa.com/t/as3-splitting-bitmapdata-into-tiles/292683>\
**Category:** programming\
**Created:** [July 17, 2009, 2:20pm UTC](https://forum.kirupa.com/t/as3-splitting-bitmapdata-into-tiles/292683 "2009-07-17T14:20:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashmxboy](https://avatars.discourse-cdn.com/v4/letter/f/779978/32.png) [@flashmxboy](https://forum.kirupa.com/u/flashmxboy)\
**Post date:** [July 17, 2009, 2:20pm UTC](https://forum.kirupa.com/t/as3-splitting-bitmapdata-into-tiles/292683/1 "2009-07-17T14:20:23Z")

</div>

Hi everyone:hugegrin:

Im pretty sure this is easy, but i will ask anyway:P  
I have a big movieClip that contains a level for my game.  
I use bitmapData.draw() to draw it into a bitmap and use bitmapData.hitTest() to check for collisions with walls etc.  
Now if i draw a realy high/wide level flash throws this error:

> ArgumentError: Error #2015: Invalid BitmapData.  
> at flash.display::BitmapData()

or the whole level dosen`t show up:P

So i thougt the solution would be to split up the bitmapData in tiles.  
Something like this:  
  
(The red squares are tiles…)

How would i do this? And would it ruin my bitmapData.hitTest() ??

Thanks in advance:D
