I have been using TweenLite in my Actionscript 2.0 project (it's a HUD widget mod for Skyrim which still uses AS2!!!!) with great results. I have now begun to incorporate TimelineLite timelines and see great potential but am running into a few initial problems which I have no doubt are user error (I am not a programmer, just a hobby coder) or lack of understanding of the fundamentals. Allow me to post a couple of snippets to highlight the main issues I'm having.
Firstly:
//Create the animation timeline
//Fade out and shrink the icon
tl.to(iconClip, 0.2, {_alpha:0, _xscale:0.25, _yscale:0.25, ease:Quad.easeOut}, 0)
//Fade out the name
.to(nameClip, 0.2, {_alpha:0, ease:Quad.easeOut}, 0)
//Set the new icon and name whilst not visible
.call(updateIconAndName, [itemIcon, itemName, sIcon, sName]);
//Update the potion and poison colors if needed
if (iSlot == 3){
tl.call(updatePotionIconColor, [sIcon]);
} else if (iSlot == 4){
tl.call(updatePoisonIconColor);
}
//Fade and scale the new icon back in
tl.to(iconClip, 0.2, {_alpha:currAlpha, _xscale:currScale, _yscale:currScale, ease:Quad.easeOut}, 0.3)
//Finally fade the new name back in
.to(nameClip, 0.2, {_alpha:iNameAlpha, ease:Quad.easeOut}, 0.3)
.call(startNameFadeTimer, [nameClip, FadeDelay]);
//And ACTION!
tl.play();
In this example the initial fade out works but the scale doesn't, the nameClip fade out works, the updateIconAndName call works and then the fade/scale back in on the two clips works. However the two calls in the middle are never added if one or other of the conditions are true, and the final call to startNameFadeTimer also doesn't seem to be being called. Or possibly it is and there's an issue with the startNameFadeTimer function which uses TweenLite.delayedCall():
public function startNameFadeTimer(nameClip: MovieClip, FadeDelay: Number): Void
{
TweenLite.delayedCall(FadeDelay, tweenWidgetNameAlpha, [nameClip, 0, 1.0]);
}
And the other issue I am having is with the following code:
public function ProModeAnimateIn(shoutEnabled: Boolean, backgroundsEnabled: Boolean, toScaleLB: Number, toAlphaLB: Number, toRotationLB: Number, toScaleLI: Number, toAlphaLI: Number, toRotationLI: Number, toAlphaLN: Number, toScaleRB: Number, toAlphaRB: Number, toRotationRB: Number,toScaleRI: Number, toAlphaRI: Number, toRotationRI: Number, toAlphaRN: Number, toScaleSB: Number, toAlphaSB: Number, toRotationSB: Number, toScaleSI: Number, toAlphaSI: Number, toRotationSI: Number, toAlphaSN: Number): Void
{
var tl = new TimelineLite({paused:true, autoRemoveChildren:true});
tl.to(leftPreselectIcon_mc, 0.4, {_alpha:toAlphaLI, _xscale:toScaleLI, _yscale:toScaleLI, ease:Elastic.easeOut}, 0)
.fromTo(leftPreselectIcon_mc, 0.4, {_rotation:(toRotationLI - 120), _rotation:toRotationLI}, 0);
if (backgroundsEnabled == true){
tl.to(leftPreselectBg_mc, 0.4, {_alpha:toAlphaLB, _xscale:toScaleLB, _yscale:toScaleLB, ease:Quad.easeOut}, 0)
.fromTo(leftPreselectBg_mc, 0.4, {_rotation:(toRotationLB - 90), _rotation:toRotationLB}, 0);
}
tl.to(leftPreselectName_mc, 0.3, {_alpha:toAlphaLN}, 0.3);
if (shoutEnabled == true){
tl.to(shoutPreselectIcon_mc, 0.4, {_alpha:toAlphaSI, _rotation:toRotationSI, _xscale:toScaleSI, _yscale:toScaleSI, ease:Elastic.easeOut}, 0.2)
.fromTo(shoutPreselectIcon_mc, 0.4, {_rotation:(toRotationSI - 120), _rotation:toRotationSI}, 0.2);
if (backgroundsEnabled == true){
tl.to(shoutPreselectBg_mc, 0.4, {_alpha:toAlphaSB, _xscale:toScaleSB, _yscale:toScaleSB, ease:Quad.easeOut}, 0.2)
.fromTo(shoutPreselectBg_mc, 0.4, {_rotation:(toRotationSB - 90), _rotation:toRotationSB}, 0.2);
}
tl.to(shoutPreselectName_mc, 0.3, {_alpha:toAlphaSN}, 0.5);
}
tl.to(rightPreselectIcon_mc, 0.4, {_alpha:toAlphaRI, _rotation:toRotationRI, _xscale:toScaleRI, _yscale:toScaleRI, ease:Elastic.easeOut}, "-=0.4")
.fromTo(rightPreselectIcon_mc, 0.4, {_rotation:(toRotationRI - 120), _rotation:toRotationRI}, "-=0.4");
if (backgroundsEnabled == true){
tl.to(rightPreselectBg_mc, 0.4, {_alpha:toAlphaRB, _xscale:toScaleRB, _yscale:toScaleRB, ease:Quad.easeOut}, "-=0.4")
.fromTo(rightPreselectBg_mc, 0.4, {_rotation:(toRotationRB - 90), _rotation:toRotationRB}, "-=0.4");
}
tl.to(rightPreselectName_mc, 0.3, {_alpha:toAlphaRN}, "-=0.1");
tl.play();
}
First off again the fade works but the rotation/scale doesn't, and none of the stuff supposedly being added to tl inside of the if statements works.
If anyone can give me any pointers on any of the above I would be most grateful.