Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

TimelineLite questions (AS2, yes that's right!)

Recommended Posts

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.




//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){
//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]);


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");


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.

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums,


We stopped supporting the Flash tools many years ago. I haven't touched AS2 in a decade so it just isn't feasible to look at a junk of code and imagine how your conditions are evaluating, what code is being executed, and what is being displayed.



With that said, since you are using multiple fromTo() tweens on what may be the same properties of the same element you may need to set immediateRender:false on some of those.


The video and info below is for JS but the same concept applies




Glad to hear you are getting some mileage out of the AS2 stuff still, but please understand it just isn't the type of thing we can support, especially since Adobe dropped support for it as well.




Link to comment
Share on other sites

@CarlThanks for the reply.  Yeah,  I am well aware how archaic it is now but it's what I'm stuck with unfortunately!  I only posted in the hope someone would take a quick look and say "You can't use "if" statements inside a TimelineLite construction" or you can't call .to and .fromTo on the same object at the same time, or anything similar.


I'll keep experimenting and see where I get!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.