I am despairing with fuse… I am using it for a long time now, but I dont understand my error. I am trying to start different functions, after the previous one has finished.
I have 4 movieclips (project1, project2, project3, project4) that I want to move as group with slight delay to each other. After clicking on one of them I want it to move to a predefined position with all the other moviclips following. Right after reaching its predefined position I want the projects with a smaller index to move as group down to make space for some content. Here is my code:
Code:
//Setup and register with Zego Engine
import com.mosesSupposes.fuse.*;
ZigoEngine.simpleSetup( Shortcuts, PennerEasing, Fuse );
//-----------------------------------------------------------
//Setup Variables
var projects_counter:Number = 0;
//trace("initial projects_counter = "+projects_counter);
var max:Number = 6;
//-----------------------------------------------------------
function move() //starts the movement of all projects, y:"movement target in absolute coords")
{
for ( var s = 1; s < max; s++ )
{
var f:Fuse = new Fuse ();
f.push ([
{target: _root["project"+(projects_counter+1-s)], y: 100-(s*35), time: 1+(1/((1/s)+1)), ease:"easeOutQuint"}, //move all elements with smaller index than the clicked one
{target: _root["project"+(projects_counter+s)], y: 100+((s-1)*35), time: 1+(1/((1/s)+1)), ease:"easeOutQuint"} //move all elements with higher index and including the clicked one
]);
/* f.push(
{func:open, scope:this} //starting "open"
);*/
f.start();
//trace("(move) s = "+s);
}
}
function open() //opens the menu for the content, y:"opening value (relative distance)"
{
for ( var n = 1; n < max; n++ )
{
var f2:Fuse = new Fuse ();
f2.push (
{target: _root["project"+(projects_counter + n+1)], y:"200", delay: 0.2, time: 2+(1/((1/n)+1)), ease:"easeOutBack"}
);
f2.start();
//trace("(open) n = "+n);
}
}
function close() //closes the menu
{
for ( var r = 1; r < max; r++ )
{
var f3:Fuse = new Fuse ();
f3.push (
{target: _root["project"+(projects_counter + r+1)], y:"-200", delay: 0.2, time: 2+(1/((1/r)+1)), ease:"easeInBack"}
);
f3.start();
//trace("(close) r = "+r);
}
}
_root.project1.onPress = function()
{
projects_counter = 0;
move();
}
_root.project2.onPress = function()
{
open();
}
_root.project3.onPress = function()
{
projects_counter = 2;
move();
}
_root.project4.onPress = function()
{
projects_counter = 3;
move();
}
stop();
My problem is, that the movement to the predefined position works as intended, but as soon as I enable the function "open" its screwing things up and I have no idea why.
How do I get the function "open" to start after the function "move" has finished without screwing things up? "Close" is working as intended only if I start it by clicking on a button but not automatically. I have my fla-file attached and disabled the function "open" for you to see what i want to happen. (click the red box for the open function) Enable it, to see the mess
I am really hoping that someone can help me. I am at my wit's end.