[AS3]Using caurina Tweener

Tecsi Aron
Been working in IT since 2000, mostly in VB* till 3 years ago, when i migrated to Flash and AS3. Made several projects that combine AS3 with PHP. Mostly worked on games and Desktop applications.
View all articles by Tecsi AronAnimation sequences are also much easer to make, as you no longer need to synchronize your tweens using events, for example:
There are practically two tweens one that changes x,y and alpha, it lasts 2 seconds as you can see in the code above, and one that changes the rotation.
The code is:
import caurina.transitions.Tweener;
Tweener.addTween(box,{x:300, y:100, alpha:1, time:2, transition:"linear"});
Tweener.addTween(box,{rotation:50, time:1, transition:"linear",delay:2.5});
No events no nothing just one extra parameter: "delay". As you can see it's set to 2.5, the length of the first tween is 2, so practicly the second tween starts 0.5 seconds after the first one finishes.
Still you may want to do something when your tween finishes playing, you accomplished this by 'addEventListener(Event.COMPLETE)' with tweener it's just another parameter as such:
Tweener.addTween(box,{rotation:50, time:1, transition:"linear",delay:2.5, onComplete:doThis});
function doThis()
{
trace("here");
}
doThis will be called when tween has completed. As you can see doThis doesn't have any parameters, wich might be good, but in case you do need parameters, that is easy to acomplish as well:
Tweener.addTween(box,{rotation:50, time:1, transition:"linear",delay:2.5, onComplete:doThis, onCompleteParams:["hello world"]});
function doThis(s:String)
{
trace(s);
}
NOTE: "hello world" can be replaced with a variable, or with multiple variables separated with comas. For example:
var nr1:Number=1;
var nr2:Number=2;
var nr3:Number=3;
Tweener.addTween(box,{rotation:50, time:1, transition:"linear",delay:2.5, onComplete:doThis, onCompleteParams:[nr1,nr2,nr3]});
function doThis(n1:Number, n2:Number, n3:Number)
{
trace(n1+n2+n3);
}
You can download examples from here.
You can read the online documentation for Tweener here.
You can download Tweener from here.
Hope somebody will find this usefull,
Best regards.
Spread The Word
Related Articles
Attachments
16 Responses to "[AS3]Using caurina Tweener" 
|
said this on 11 Jul 2009 6:42:30 AM CDT
What a cool tutorial! Thi
|
|
said this on 28 Aug 2009 4:04:35 PM CDT
Use easeoutExpo in the tr
|
|
said this on 17 Jul 2009 10:32:21 AM CDT
Hi this is good. I wonder
|
|
said this on 19 Jul 2009 6:39:10 PM CDT
Object you're tweening:
You can also p Then th Parameters like the x po var obj:Object = obj["x"] = 100; ob obj.time = obj.transition = "li obj.onComplete = Tweener.addTw |
|
said this on 17 Jul 2009 11:32:33 PM CDT
This actually taught me s
I didn |
|
said this on 20 Jul 2009 3:46:05 AM CDT
Since I used tweener for
|
|
said this on 29 Jul 2009 2:28:47 PM CDT
"The native one has bugs.
Third-party tween < |
|
said this on 29 Jul 2009 3:34:35 PM CDT
nice beginner stuff.
and |
|
said this on 30 Jul 2009 3:55:21 PM CDT
Nicely covered, I'm the s
Things like fra You can It It allows you to mo It has ac Cau http://blo incase it |
|
said this on 17 Sep 2009 1:23:50 PM CDT
To Dave: I guess you have
- AS2 - Use a fram - Tweens stay i - onCom - Modify/overwrite ac - All filters s - Delay. H Here's so |
|
said this on 07 Jan 2010 7:00:30 AM CDT
thx this site rocks!
|
|
said this on 30 Jul 2010 4:27:45 AM CDT
good article thanks. I fo
Thi Hope t |
|
said this on 11 Sep 2010 10:27:42 PM CDT
Thanks to everyone ..
Re :-) |
|
said this on 19 Jul 2011 6:43:23 AM CDT
Thank you sir!!!! Lifesav
|


Author/Admin)