couldnt you just use 2 methods in your class to control the sequence of
tweens?
// Start a tween for a photo
private function tweenPhoto()
(...)
You see, that's what I'm totally against when writing code:
overcomplication. Going around and around and around to come back and do
something quite small.
Martin, do not take this personally, I don't mean to sound rude or anything,
I'm sorry in advance if I do, and your code totally makes logical sense and
it's 100% correct, but... WHY would someone need so much code just to
produce sequential tweenings? A bunch of specialized functions just to make
it work? And then suppose he has an slightly different animation he wants to
do at the same time, will he need new functions, or add parameters to those
functions, and so long and so forth? Why something so convoluted for
something so simple? Simply because the tweening doesn't support delays? :(
Going back to the original post: if I were to code that using MC Tween (I'll
use my code as an example, because I'm not so acquainted with other
extension's code). Anyways, I'd do it like this:
var delay = 0;
for (var prop in photoStrip) {
if (prop != _childCounter) {
photoStrip[prop].tween("_yscale", 120, 0.5, "easeinout", delay);
photoStrip[prop].tween("_xscale", 120, 0.5, "easeinout", delay);
delay += 0.5;
}
}
or even:
var delay = 0;
for (var prop in photoStrip) {
if (prop != _childCounter) {
photoStrip[prop].scaleTo(120, 0.5, "easeinout", delay);
delay += 0.5;
}
}
or to use some other "as1-less" syntax, once again my own's
zeh.easing.Tweener, a static as2 class which provide a one-shot method for
animation triggering:
import zeh.easing.Tweener;
var delay = 0;
for (var prop in photoStrip) {
if (prop != _childCounter) {
Tweener.addTween(photoStrip[prop], {_xscale:120, _yscale:120, time:0.5,
transition:"easeinout", delay:delay});
delay += 0.5;
}
}
or just in one line (or maybe two with the 'import' statement):
import zeh.easing.Tweener;
for (var i:Number = 0; i < photoStrip.length; i++)
Tweener.addTween(photoStrip[prop], {_xscale:120, _yscale:120, time:0.5,
transition:"easeinout", delay:0.5 * i});
Really. WHY does it have to be more complicated than that? ..Functions?
..setIntervals? ..Delegates? What's next, a "sequential animation calling
design pattern" with 10 different methods? Just for a one-shot sequential
animation? And still making it more difficult and less practical -- less
easy to change?
It's just sequential animations, no secret, no big deal. Why not fit the
solution to it, using any of the existing solutions that support delays,
instead of going 1000 extra miles? Do programmers bill by number of
functions they've written?
Sorry for the rant, but really, there's a moment you have to use the best
tool for the task - and I don't mean only the easiest. The tweening classes
included on Flash are cool and all that, but they're too basic, too raw. Why
you'd need dozens of lines just to do something that can be done with one
single line in a pretty straightforward way is beyond me. Most of the times
I have to build sites, there's so much having to be animated correctly that
if I resorted to functions and complex callbacks any time I needed some kind
of sequence or delay, my code would be a complete mess and the sequence
would be unmaintainable. Now, with delays it's as easy as it gets. It's
easier to read, debug, write, change, etc.
My advice is to still use another solution. MC Tween, laco's, Fuse Kit, it
doesn't matter. Any of them will do the trick. And probably next version of
Flash's tweening functions, considering Robert Penner is working for them
now.
- Zeh
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com