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.
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