Copypixels problem

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


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.