# Copypixels problem

**URL:** https://forum.kirupa.com/t/copypixels-problem/203141
**Category:** flash
**Created:** [October 8, 2006, 5:58am UTC](https://forum.kirupa.com/t/copypixels-problem/203141 "2006-10-08T05:58:43Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Flashthinker](https://avatars.discourse-cdn.com/v4/letter/f/dbc845/32.png) [@Flashthinker](https://forum.kirupa.com/u/Flashthinker)
#### Post date: [October 8, 2006, 5:58am UTC](https://forum.kirupa.com/t/copypixels-problem/203141/1 "2006-10-08T05:58:43Z")

</div>

Well, I’m trying to make a ray-casting engine in flash but I came across a problem which I can’t solve.

```auto

import flash.display.BitmapData
import flash.geom.Rectangle
import flash.geom.Point
this.createEmptyMovieClip("clip",1)
texture = BitmapData.loadBitmap("aqua")
for(i=0;i<400;i++){
this["pixel"+i]=new BitmapData(1,250)
this["pixel"+i].copyPixels(texture,new Rectangle(i,0,1,250),new Point(i,0))
}
for(g=0;g<400;g++){
clip.attachBitmap(this["pixel"+g],this.getNextHighestDepth())
}

```

Basically, I want strips of pixels to be made into individual bitmaps 1 x 250 pixels. Then I want these stips to be re-constituted inside a movieclip called “clip.”

The original input image has the identifier “aqua” and is 400 x 250 pixels in size.

I don’t see ANY problem with the code, why doesn’t it just work?

Also, I noticed that it could in fact work with a single column of pixels if I altered this line of code: this[“pixel”+i].copyPixels(texture,new Rectangle(i,0,1,250),new Point(i,0))

To this: this[“pixel”+i].copyPixels(texture,new Rectangle(i,0,1,250),i)

It’s strange… Does anyone know what is wrong?

Thanks.
