# Dynamic creation of buttons

**URL:** https://forum.kirupa.com/t/dynamic-creation-of-buttons/26184
**Category:** flash
**Created:** [July 20, 2003, 6:37pm UTC](https://forum.kirupa.com/t/dynamic-creation-of-buttons/26184 "2003-07-20T18:37:16Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![potamus](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@potamus](https://forum.kirupa.com/u/potamus)
#### Post date: [July 20, 2003, 6:37pm UTC](https://forum.kirupa.com/t/dynamic-creation-of-buttons/26184/1 "2003-07-20T18:37:16Z")

</div>

I’m trying to create buttons dynamically… i found a thread dealing with how to do this, how to draw lines, add text, etc. but what I really want to do is add a small section of a larger image contained in my library to each button.

To clarify I want to create four buttons dynamically and have each button contain a unique quarter of the the graphic in my library.

Any ideas?

Thanks a lot.

Potamus

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2003, 8:07pm UTC](https://forum.kirupa.com/t/dynamic-creation-of-buttons/26184/2 "2003-07-21T20:07:20Z")

</div>

could make each quater into movie clips then use the attach method to get them from the library and put them on the stage.

V.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2003, 8:35pm UTC](https://forum.kirupa.com/t/dynamic-creation-of-buttons/26184/3 "2003-07-21T20:35:44Z")

</div>

post your script that you’re using to create the buttons and i can help

if you’re using a ‘for’ loop then you can just assign the box to contain an image matching its number. i.e. if you have 4 images and 4 boxes then you can tell the for loop to put image 1 in box 1 and so on.

post it up and i’ll help if i’m able =)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 22, 2003, 8:08pm UTC](https://forum.kirupa.com/t/dynamic-creation-of-buttons/26184/4 "2003-07-22T20:08:28Z")

</div>

Thanks guys but I must not be conveying my problem accurately. I don’t have a script to post b/c I don’t know if it can be written. I am familiar with and have used the attachMovie method, ‘for’ loops… etc.

my problem is that i’m lazy. I’m creating a puzzle game and each piece is a section of a larger image. the last thing i want to do is divide my image into 25 movie clips manually. what i want to do is us AS to do it for me, that way I won’t go mad and I can create many puzzles with little extra effort.

I’ve since been looking around a bit and no luck… Thanks again for any info.

Potamus
