Let me start off by saying that I am a Dojo noob (and rusty on my JS), so this is probably an easy fix that I am overlooking, but I have been searching the forums for the past two day, to no avail.
I am trying to get an array of nodes, take the first node in the array, fade it out, remove the node, and repeat with the next node until all nodes in the array are gone.
At first I tried using this:
while(arr.length > 0){
myAnim.play()
}, but it loops again before the animation can finish. So I just gave up and tried connecting a "callAgain" to an onEnd function of an animation.
This is what I have right now (I know there's probably a better way to write this):
function eatToast(){
var toaster = dojo.byId('MainToaster');
var eatSlice = dojo.query(".toasterMessage").shift();
var burnToast = dojo.fadeOut({
node: eatSlice,
duration: 500});
dojo.connect(burnToast, 'onEnd', function(){
var currMar = parseInt(toaster.style.marginTop)+eatSlice.offsetHeight;
toaster.style.marginTop = currMar+"px";
toaster.removeChild(eatSlice);
eatSlice = dojo.query(".toasterMessage").shift();
yummyToast();
});
dojo.connect(burnToast, "onAnimate", function(){
console.log(burnToast.status());
});
function yummyToast(){
burnToast.play(200);
}
yummyToast();
}My problem is that the first time the animation runs, every thing runs smoothly. But every time after that, the fadeOut animation does NOT get played, but the node DOES get removed. It seems as if it's only running the onEnd.
Any help would be GREATLY appreciated.
