I have four buttons on the stage which I want to move 20 pixels up (easing) and fade in from 0 to 100. But I want them to appear with a interval of 1 second. I came up with the following function:
function showClips(yPos, alpha, speed) {
var endY = yPos - this._y;
this._y += eindY /speed;
var endA = alpha - this._alpha;
this._alpha += endA / speed;
if (clips.length) {
clips[0]._visible = true;
clips.splice(0, 1);
} else {
clearInterval(id);
}
updateAfterEvent();
}
var clips = [];
var index = 0;
while (index++ < 4) {
var clip = eval("but_"+(index < 5 ? "0" : "")+index);
clip._visible = false;
clips.push(clip);
}
var id = setInterval(showClips, 1000, 304, 100, 3);
But it isn’t working. The clips just appear on the stage without movement and fading. What is wrong with my function?