# How to make a button work

**URL:** <https://forum.kirupa.com/t/how-to-make-a-button-work/59646>\
**Category:** Uncategorized\
**Created:** [August 2, 2004, 7:15pm UTC](https://forum.kirupa.com/t/how-to-make-a-button-work/59646 "2004-08-02T19:15:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sundeep](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@sundeep](https://forum.kirupa.com/u/sundeep)\
**Post date:** [August 2, 2004, 7:15pm UTC](https://forum.kirupa.com/t/how-to-make-a-button-work/59646/1 "2004-08-02T19:15:17Z")

</div>

hi,i am trying to to do the following. I have 2 buttons on a page.when i click the first button it should just display the image i want it to.when i click the second button it should display the other image i want to display.  
could u help me out with this.  
i appreciate u helping me out  
thanks

---

<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:** [August 2, 2004, 7:19pm UTC](https://forum.kirupa.com/t/how-to-make-a-button-work/59646/2 "2004-08-02T19:19:04Z")

</div>

Welcome to the forums! 🙂

What I would do is create an empty movie clip and give it an instance name of “container” (no quotes). Place it on your stage where you want your picture to show up. Put this code on your buttons:

```auto

//button 1
on(release){
container.loadMovie("yourpicture.jpg");
}

//on button 2
on(release){
container.loadMovie("yourOtherPicture.jpg");
}

```

Whenever you use loadMovie to load something (external swf, jpg, whatever) into a container clip it will replace whatever was in there before, so if you DON’T want that to happen we’ll have to find another workaround.

Hope this helps!

:hr:

---

<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:** [August 2, 2004, 7:22pm UTC](https://forum.kirupa.com/t/how-to-make-a-button-work/59646/3 "2004-08-02T19:22:12Z")

</div>

> [@sundeep](#):
>
> hi,i am trying to to do the following. I have 2 buttons on a page.when i click the first button it should just display the image i want it to.when i click the second button it should display the other image i want to display.  
> could u help me out with this.  
> i appreciate u helping me out  
> thanks

in the property inspector, give your buttons instance names btn1 and btn2.  
convert the 2 images to movieclips and give them instance names mc1 and mc2.  
on the main timeline(containing all the clips,open the actions panel click on the first frame and type  
mc1.\_visible = false;  
mc2.\_visible = false;  
btn1.onPress = function() {  
mc1.\_visible = true;  
mc2.\_visible = false;  
};  
btn2.onPress = function() {  
mc2.\_visible = true;  
mc1.\_visible = false;  
};
