How to make a button work

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

Welcome to the forums! :slight_smile:

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:


//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:

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;
};