Jump to content
Search Community

make mc go at the same time [SOLVED]

chefkeifer test
Moderator Tag

Recommended Posts

i have this code but i want it to happen at the same time..but some i want to happen one after another..how to i go about this..

 

function flagWave(){
var flag:Kflag = new Kflag();
flag.source = "imagesCAW/flag.gif";
addChild(flag);
flag.alpha = 0;
atv.alpha = 0;
var enterStage:TimelineMax = new TimelineMax();
		enterStage.append(TweenMax.to(flag, .5, {x:1088, y:135}));
		enterStage.append(TweenMax.to(atv,  .5, {x:850, y:210}));
		enterStage.append(TweenMax.to(flag,  1, {alpha:1}));
		enterStage.append(TweenMax.to(atv,   1, {alpha:1}));
		enterStage.append(TweenMax.to(flag,  1, {x:"-200"}));
flag.wave_width =.5;
flag.wave_height = 0.75;
flag.wave_speed = 4;
flag.hang_side = "left";
}
flagWave();

Link to comment
Share on other sites

When you append() a tween, it'll put it at the END of the timeline, so since you're appending all your tweens one-after-the-other, they'll play one-after-the-other. But you can use the insert() method to place a tween anywhere on the timeline. For example, here are 2 tweens that I'll place at exactly 2-seconds into the timeline:

 

myTimeline.insert( TweenMax.to(mc, 1, {x:100}), 2);
myTimeline.insert( TweenMax.to(mc2, 1, {y:140}), 2);

 

You can put ANY tween ANYWHERE on the timeline. They can overlap as much as you want.

 

Make sense?

Link to comment
Share on other sites

Either of these would work:

 

myTimeline.insertMultiple( TweenMax.allTo([mc1, mc2], 1, {alpha:0.5, x:100, y:100}), 2);

 

or

 

myTimeline.insert( TweenLite.to(mc1, 1, {alpha:0.5, x:100, y:100}), 2);
myTimeline.insert( TweenLite.to(mc2, 1, {alpha:0.5, x:100, y:100}), 2);

 

(they both insert those tweens at exactly 2-seconds in. You could put them anywhere of course. Just change the last parameter in each insert() or the insertMultiple() method(s).

Link to comment
Share on other sites

ok..i got that to work..finally..took me a while...when you only work on the websites every so often..you have to go back and re learn how to do everything..thanks for that...

 

quick quesiton...

how do i get both of these to happen at the same time but i do not want the alpha to start fading out until halfway through the first tween...does that make sense...to give you a visual..this is a atv going away from the screen like its going into the woods..i want the user to be able to see the atv most of the time and then start to fade away as the scale begins to go down

flagEnter.append( TweenMax.to(atv, 1, {x:400, y:161, scaleX:0.1, scaleY:0.1, ease:Linear.easeOut}));
flagEnter.append( TweenMax.to(atv, 1, {alpha:0}));

Link to comment
Share on other sites

There are a bunch of ways you could accomplish that, but here's one:

 

flagEnter.append( TweenMax.to(atv, 1, {x:400, y:161, scaleX:0.1, scaleY:0.1, ease:Linear.easeOut}));
flagEnter.insert( TweenMax.to(atv, 0.5, {alpha:0}), flagEnter.duration - 0.5); //overlap the previous tween by 0.5 seconds

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...