Hi everyone!
I am converting the tweens in a project from the standard Flash tweens to TweenLite/Max, but I have encountered a problem, I mean something I don’t know how to do, or if it is possible to do.
Let’s see an example:
old tween:
[COLOR=#008000]new Tween(page1, transitionType, Regular.easeOut, BStart, BEnd, transitionSpeed, true);
[/COLOR]
where
“transitionType” is a String: “x”, “y”, “rotationY” or “alpha”
“BStart” and “BEnd” are the initial and final values of the tween.
The TweenLite version is:
[COLOR=#008000]page1.x = BStart;
TweenLite.to(page1, transitionSpeed, {x : BEnd});
[/COLOR]
I don’t know how to set the start and end point in the same line of the tween, so I first set the initial coordinate of “page1” and then move it by the tween. Anyway this is not the real problem.
The problem I stumbled onto is: how do I dynamically set the transitionType for the tween?
I would need something like
[COLOR=#008000]page1.[/COLOR][COLOR=#b22222]**#transitionType#**[/COLOR][COLOR=#008000] = BStart;
TweenLite.to(page1, transitionSpeed, {[/COLOR][COLOR=#b22222]**#transitionType#**[/COLOR][COLOR=#008000] : BEnd});
[/COLOR]
to avoid to switch between the 4 (and more) possible transitionTypes.
In the first line I could write [COLOR=#008000]page1[transitionType][/COLOR], ok, but if I had [COLOR=#008000]pages[“page”+i][/COLOR] instead of [COLOR=#008000]page1[/COLOR]? I think I should use an alias, right? [COLOR=#008000]pages[“page”+i][transitionType][/COLOR] is totally wrong.
[COLOR=#008000]var mickey:MovieClip = pages["page"+i];
mickey[transitionType] = BStart;
[/COLOR]
I can’t try this now, it is just a guess…
Anyway… how do I set dynamic parameters and properties? Mumble mumble
Thanks!
:look: