# Split Images with Action Script

**URL:** <https://forum.kirupa.com/t/split-images-with-action-script/118171>\
**Category:** Uncategorized\
**Created:** [August 3, 2004, 11:12am UTC](https://forum.kirupa.com/t/split-images-with-action-script/118171 "2004-08-03T11:12:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_4\_Cologne](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Alex\_4\_Cologne](https://forum.kirupa.com/u/Alex_4_Cologne)\
**Post date:** [August 3, 2004, 11:12am UTC](https://forum.kirupa.com/t/split-images-with-action-script/118171/1 "2004-08-03T11:12:15Z")

</div>

Can I split Images by Action Script? Watch [this](http://alex.wis.k.plenum.de/www/squares.swf). Currently all pieces are done manually. Any solutions? thx 4 help.

---

<div class="post-metadata">

**Author:** ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)\
**Post date:** [August 3, 2004, 1:01pm UTC](https://forum.kirupa.com/t/split-images-with-action-script/118171/2 "2004-08-03T13:01:26Z")

</div>

> [@Alex 4 Cologne](#):
>
> Can I split Images by Action Script? Watch [this](http://alex.wis.k.plenum.de/www/squares.swf). Currently all pieces are done manually. Any solutions? thx 4 help.

This is extremely simple to do using actionscript.  
Draw one square,convert to a movieclip,give it a linkage identifier mc.Go back to the main timeline and if you have a square, delete it.  
open the actions panel,click the first frame and type  
createEmptyMovieClip(“box”, 1);  
columns = 20;  
rows = 15;  
for (var y = 0; y\<columns; y++) {  
for (var x = 0; x\<rows; x++) {  
i++;  
box.attachMovie(“mc”, i, i);  
box\*.\_x = x_box_.\_width;  
box\*.\_y = y_box_.\_height;  
box\*.onRollOver = move;  
}  
}  
function move() {  
this.onEnterFrame = function() {  
this.\_rotation += 2;  
this.\_xscale = this.\_yscale -= 2;  
if (this.\_xscale\<10) {  
removeMovieClip(this);  
}  
};  
}

you`ll have to play about a bit with variables etc.

---

<div class="post-metadata">

**Author:** ![Alex\_4\_Cologne](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Alex\_4\_Cologne](https://forum.kirupa.com/u/Alex_4_Cologne)\
**Post date:** [August 3, 2004, 1:17pm UTC](https://forum.kirupa.com/t/split-images-with-action-script/118171/3 "2004-08-03T13:17:33Z")

</div>

yeah thx, but this was not what i am searching for.

its not about squares each equal, i wanna split graphics like the background picture u know? so imagine they gray layer in the example as another model photograph which should be splitted by action script.

---

<div class="post-metadata">

**Author:** ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)\
**Post date:** [August 3, 2004, 1:41pm UTC](https://forum.kirupa.com/t/split-images-with-action-script/118171/4 "2004-08-03T13:41:27Z")

</div>

> [@Alex 4 Cologne](#):
>
> yeah thx, but this was not what i am searching for.
> 
> its not about squares each equal, i wanna split graphics like the background picture u know? so imagine they gray layer in the example as another model photograph which should be splitted by action script.

All you have to do is put your 2 model photos in different layers, convert to movieclips and then mask the top one with box.  
say you call it clip1  
just use the same code and put  
clip1.setMask(box) after you have created the empty movieclip.

---

<div class="post-metadata">

**Author:** ![bobdoe](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bobdoe](https://forum.kirupa.com/u/bobdoe)\
**Post date:** [August 3, 2004, 1:42pm UTC](https://forum.kirupa.com/t/split-images-with-action-script/118171/5 "2004-08-03T13:42:40Z")

</div>

well, i dont think you can actually split an image like that. But what you can do is make a mask over your 2nd image. And when the blocks disappear, the other image shows up. It all depends on what you want to mask and unmask.

---

<div class="post-metadata">

**Author:** ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)\
**Post date:** [August 3, 2004, 1:50pm UTC](https://forum.kirupa.com/t/split-images-with-action-script/118171/6 "2004-08-03T13:50:02Z")

</div>

> [@bobdoe](#):
>
> well, i dont think you can actually split an image like that. But what you can do is make a mask over your 2nd image. And when the blocks disappear, the other image shows up. It all depends on what you want to mask and unmask.

snap!

---

<div class="post-metadata">

**Author:** ![Alex\_4\_Cologne](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Alex\_4\_Cologne](https://forum.kirupa.com/u/Alex_4_Cologne)\
**Post date:** [August 3, 2004, 1:53pm UTC](https://forum.kirupa.com/t/split-images-with-action-script/118171/7 "2004-08-03T13:53:24Z")

</div>

k thx this should at least help me to fulfill my task

if there are any other ideas for really splitting images please let me now.
