I am updating source code I came across to AS 2.0 and I am having problems with the tweens. Here is what I am trying to accomplish in AS2.0:
http://www.mustardlab.com/developer/test/new/
**
Here is the part of my updated code I am having problems with:**
var mover:Fuse = new Fuse();
var rotate:Fuse = new Fuse();
// treat invisible movieclip as a button…do following after each mouseclick
Cover.onRelease = function() {
//stop fast click interrupt tween
// figure out how to make stack depth change after tween part 1
mover.pop();
mover.pop();
// Shuffle the current top image to the side
stack[0].changerot = (Math.random()*16)-8-stack[0].rot; // calculate random rotation that MC will change to
mover.pushTween(stack[0],["_x","_y","_rotation"],[gox,goy,stack[0].changerot],0.05,“easeInQuad”,0);
mover.pushTween(stack[0],["_x","_y"],[0,0], 0.05, “easeOutQuad”,0);
mover.start();
stack[0].swapDepths(depth--);
// tween the 2nd image so its straight and no longer rotated
rotate.pop();
rotate.pushTween(stack[1],["_rotation"],[-stack[1].rot],0.05,"easeOutQuad",0);
rotate.start();
// Move top image to the back of the stack array
var addback = stack.shift(); //Removes the first element from an array
stack.push(addback); // put first element at end of array
};
This is my problem:
(1) I want the top image to tween to the right and up in X and Y direction and also slightly rotate. THEN I want it to tween back underneath the other stack of pictures in center of swf. However what is happening is that the depth of the topimage is being set under all the pics right away and the tween takes place under all the pics and not ontop. Is there a way for me to wait until the tweens are done and then execute my swapDepths line?
Here are problem lines in detail:
mover.pushTween(stack[0],["_x","_y","_rotation"],[gox,goy,stack[0].changerot],0.05,“easeInQuad”,0);
mover.pushTween(stack[0],["_x","_y"],[0,0], 0.05, “easeOutQuad”,0);
mover.start();
stack[0].swapDepths(depth--); // I want this to take place right after 1st pushTween and before 2nd pushTween