# Fade in Fade out with external pictures

**URL:** <https://forum.kirupa.com/t/fade-in-fade-out-with-external-pictures/176720>\
**Category:** flash\
**Created:** [January 26, 2006, 11:20am UTC](https://forum.kirupa.com/t/fade-in-fade-out-with-external-pictures/176720 "2006-01-26T11:20:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dboers](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dboers](https://forum.kirupa.com/u/dboers)\
**Post date:** [January 26, 2006, 11:20am UTC](https://forum.kirupa.com/t/fade-in-fade-out-with-external-pictures/176720/1 "2006-01-26T11:20:03Z")

</div>

I use the following script to fade in and fade out four pictures on the stage. How should I adjust the script so that it is working with external pictures or pictures in the library.

```auto
function fadePics() {
 var prev = pics[index];
 index = ++index%pics.length;
 var next = pics[index];
 prev.onEnterFrame = function() {
  this._alpha += (0-this._alpha)/ease;
  if (Math.abs(this._alpha)<1) {
   delete this.onEnterFrame;
  }
 };
 next.onEnterFrame = function() {
  this._alpha += (100-this._alpha)/ease;
  if (Math.abs(100-this._alpha)<1) {
   delete this.onEnterFrame;
  }
 };
}
var pics = ["pic1", "pic2", "pic3", "pic4"];
for (var prop in pics) {
 pics[prop]._alpha = 0;
}
var index = -1;
var ease = 6;
var interval = 9000;
var id = setInterval(fadePics, interval);
fadePics();

```

Thanks in advance
