# Image fade in on click of button

**URL:** <https://forum.kirupa.com/t/image-fade-in-on-click-of-button/322956>\
**Category:** flash\
**Created:** [June 10, 2011, 8:30am UTC](https://forum.kirupa.com/t/image-fade-in-on-click-of-button/322956 "2011-06-10T08:30:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![beethamwest](https://avatars.discourse-cdn.com/v4/letter/b/e36b37/32.png) [@beethamwest](https://forum.kirupa.com/u/beethamwest)\
**Post date:** [June 10, 2011, 8:30am UTC](https://forum.kirupa.com/t/image-fade-in-on-click-of-button/322956/1 "2011-06-10T08:30:05Z")

</div>

So im using CS5, and i have a very basic script which makes an image appear when a button is clicked, ie click button1, and pic1 shows. click button2 and pic2 loads etc.

The script i have is this:  
stop();  
button1.addEventListener(MouseEvent.CLICK,showpic1);  
button2.addEventListener(MouseEvent.CLICK,showpic2);  
function showpic1(Event:MouseEvent):void{  
gotoAndStop(“pic1”);  
}  
function showpic2(Event:MouseEvent):void{  
gotoAndStop(“pic2”);  
}

How can i make each image fade in from 0 to 100 opacity, in for example 1 second (time isn’t that much of an issue)

Thank you
