# Split image in diferent forms/shapes

**URL:** <https://forum.kirupa.com/t/split-image-in-diferent-forms-shapes/302790>\
**Category:** flash\
**Created:** [January 7, 2010, 4:00pm UTC](https://forum.kirupa.com/t/split-image-in-diferent-forms-shapes/302790 "2010-01-07T16:00:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel\_mihalcea](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@daniel\_mihalcea](https://forum.kirupa.com/u/daniel_mihalcea)\
**Post date:** [January 7, 2010, 4:00pm UTC](https://forum.kirupa.com/t/split-image-in-diferent-forms-shapes/302790/1 "2010-01-07T16:00:29Z")

</div>

Hi there. I am trying to split an image in different forms/shapes. For the moment I have something like this and the image splits only vertical but not random forms. I what all to be random like the image in the attach.  
Here is my script for what I have for the moment:

//cine is the image movie clip  
//dd is an blank movie clip  
var bitmapData = new flash.display.BitmapData(cine.\_width, cine.\_height);  
bitmapData.draw(cine);  
var \_\_x = cine.\_x;  
var \_\_y = cine.\_y;  
var pozaSite = site.createEmptyMovieClip(“pozaSite”, 41);  
pozaSite.attachBitmap(bitmapData, 1);

```
cine._alpha = 0;

var pro = Math.round(Stage.height / 100);
var __h = pozaSite._height;
var __w = pozaSite._width;

var pro2 = Math.ceil(__h / pro);
var imL = site.createEmptyMovieClip("imL", 45);

if (n) {
    imL._x = __x;
    imL._y = __y;
}
imL.divX = pro;
imL.id = 0;
var inc = pro + 1;  
var __bitmap;
for (var k = 0; k &lt; pro; ++k) {
    __bitmap = new flash.display.BitmapData(__w, pro2, true, 0);
    var __rectangle = new flash.geom.Rectangle(__w, pro2 * k, __w, pro2);
    var dd = imL.attachMovie("dd", "d_" + k, inc, {_y: pro2 * k, _alpha: 100});

    dd.attachBitmap(__bitmap, 2, "auto", true);
    
    dd.myX = pro2 * k;
    __bitmap.copyPixels(bitmapData, new flash.geom.Rectangle(0, pro2 * k,__w, pro2), new flash.geom.Point(0, 0));
    
    --inc;
    trace(dd._width + " : " + dd._height);
}

pozaSite.removeMovieClip();

```

Thank you.  
And hope to find the answer.
