Hey,
thank you so much for your help. I got the whole thing working. I hope that I can ask you one further question concerning the whole thing
If I click on a project, the whole set of projects moves at the desired position but only for one time. If I click on another project after that it wont move again. Can I start each tween only once?
My goal is to move every single project clicked (in connection with all of the other projects) to a predefined position, independently from their actual position. That requires that I can click on a project at any time and the timelinetween fires every time again. I tried to add
timeline.restart();
at the end of the for loop, but in that case the movement is not smooth at all.
I have attached the fla file this time.
My code looks like that:
//Setup Tweenmax
import com.greensock.*;
import com.greensock.easing.*;
//--------------------------
var projects_counter:Number = 0;
var max:Number = 10;
var timeline:TimelineMax = new TimelineMax();
function move()
{
for ( var s = 1; s < max; s++ )
{ //timeline.insert( TweenMax.to(target, time, {attribute to be tweened, ease}
timeline.insert( TweenMax.to(_root["project"+(projects_counter+1-s)], (1/((1/s)+1)), {_y:100-(s*35), ease:Circ.easeOut}));
timeline.insert( TweenMax.to(_root["project"+(projects_counter+s)], (1/((1/s)+1)), {_y:100+((s-1)*35), ease:Circ.easeOut})); //Move the (with an index >= the clicked one) projects up
}
timeline.play()
}
_root.project1.onPress = function()
{
projects_counter = 0;
move();
}
_root.project2.onPress = function()
{
projects_counter = 1;
move();
}
_root.project3.onPress = function()
{
projects_counter = 2;
move();
}
//----------------------- OLD FUSE CODE BELOW -------------------------
/*
//Setup and register with Zego Engine
import com.mosesSupposes.fuse.*;
ZigoEngine.simpleSetup( Shortcuts, PennerEasing, Fuse );
//-----------------------------------------------------------
//Setup Variables
var projects_counter:Number = 0;
var max:Number = 10;
//-----------------------------------------------------------
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();
}
}
*/
stop();
Can you help me once more?
Christian