View Full Version : 2 more more Tweener tweens at once
daidai
June 7th, 2008, 01:19 PM
I have completley forgotten how to tween two at once, its something like
ActionScript Code:
Tweener.addTween [(sprite1, { time:1, y:20, transition:"easeInOutExpo" } )], [(sprite2, { time:1, y: -20, transition:"easeInOutExpo" })];
but its not that, i can remember that there's []'s in there, but I just cant remember where
thanks
Anogar
June 7th, 2008, 04:15 PM
Why don't you just stick them on two lines?
daidai
June 7th, 2008, 06:07 PM
i need them to fire at the same time
snickelfritz
June 7th, 2008, 06:58 PM
TweenMax has the "onStart" and "onComplete" params.
You can use onStart to target a function that contains your second tween.
brookisme
June 7th, 2008, 07:22 PM
the code you are writing looks similar to tweenlite (rather than the built-in tween package)
http://blog.greensock.com/tweenliteas3/
i´ve just started using it and it makes me happy, i´d recommend downloading it and using it. if you do want to use the built in package the closest i can think to have a simultaneous firing is:
import fl.transitions.Tween
import fl.transitions.easing.Regular
var a:Array = new Array(new Tween(your_mc,"x",Regular.easeIn,boxmc.x,300,1,true),
new Tween(boxmc,"y",Regular.easeIn,your_mc.y, 300,1,true))
as a side note: i´ve found putting tweens in an array like this seems to fix some of the problems i´ve run into when i do the more standard thing:
var twn1:Tween = new Tween(...)
var twn2:Tween = new Tween(...)
sometimes when removing tweens, adding listeners, etc... this will run into problems. i think it has something to do with the garbage collector... anyway putting tweens in arrays gets rid of such problems
Anogar
June 7th, 2008, 09:17 PM
i need them to fire at the same time
If you just do something like:
Tweener.addTween(myObject, {myParams});
Tweener.addTween(myObject2, {myParams});
Tweener.addTween(myObject3, {myParams});
They'll all fire at the same time. I think you're either misunderstanding how it works or you're not articulating why they need to be in the same declaration.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.