Jump to content
Search Community

Reversing autoAlpha via TimelineMax

_maxxy test
Moderator Tag

Recommended Posts

Hi,

 

I have this code for TimelineMax, which includes autoAlpha. I play the timeline, and then reverse it. All works fine, however, for some reason autoAlpha of one MC is not being reversed. I trace objects' "visible" states before and after tweening.

Any suggestions very much appreciated. The MC staying off is the first one in the array - "...hit01".

 


var timelinen1Pressed:TimelineMax = new TimelineMax({paused:true, onComplete:TRACE, onStart:TRACE, onReverseComplete:TRACE});
timelinen1Pressed.insertMultiple(TweenMax.allTo([
											Object(this.parent.parent).hit01,
											Object(this.parent.parent).N2, 
											Object(this.parent.parent).N3,
											Object(this.parent.parent).N4,
											Object(this.parent.parent).N5,
											Object(this.parent.parent).N1.S1,
											Object(this.parent.parent).N1.S2,
											Object(this.parent.parent).N1.S3], 1, {autoAlpha:0}));
timelinen1Pressed.insert(TweenMax.to(Object(this.parent.parent).N1.masker, 1.5, { rotation:90, delay:.5, scaleY:2,x:250, y:20 ,ease:Expo.easeInOut}));
timelinen1Pressed.insert(TweenMax.to(Object(this.parent.parent).N1, 1.5, {x:0, delay:.5, ease:Expo.easeInOut}));
timelinen1Pressed.insert(TweenMax.to(Object(this.parent.parent).N1.big1, 1.5, {rotation:90, x:0, y:220, scaleX:3.5, scaleY:3.5, delay:.5, ease:Expo.easeInOut}));

timelinen1Pressed.play();
TweenMax.delayedCall(3, RR);


function RR()
{
timelinen1Pressed.timeScale = 2;
timelinen1Pressed.reverse();

}

function TRACE(){
trace(Object(this.parent.parent).N1.S1.visible)
trace(Object(this.parent.parent).hit01.visible)
trace(Object(this.parent.parent).N1.S2.visible)
trace("//////");
}

 

 

this results in:

true

true

true

//////

false

false

false

//////

true

false

true

//////

 

Thanks m.

Link to comment
Share on other sites

ok, problem solved, hit01 was initially with alpha:0 so it had nothing to reverse to hence I guess it didn't reverse the second (visible) attribute either...

Another problem encountered within the same animation though:

 

mcs

Object(this.parent.parent).N1.S2, Object(this.parent.parent).N1.S1, Object(this.parent.parent).N1.S3

..disappear as expected initially. However, when I first apply some tween on those and then play the timeline, they remain ignored by it, even if I wait for the tweens to be finished. First I thought it might be something to do with "overwrite" but since they are still, I'm not sure...

 

thanks

m.

Link to comment
Share on other sites

..disappear as expected initially. However, when I first apply some tween on those and then play the timeline, they remain ignored by it, even if I wait for the tweens to be finished. First I thought it might be something to do with "overwrite" but since they are still, I'm not sure...

Can you post code or an example FLA specific to this question you have? I'm not sure what you mean by "apply some tween on those". Context is everything. For the best chances of getting a solution to your problem, please post a super-simple FLA that demonstrates the issue so we can just publish it and see exactly what you mean.

Link to comment
Share on other sites

Hey, here it is attached, pretty straightforward.

To encounter the problem I'm having, go through 2 scenarios:

 

1) Without hovering anything but the green button, press it. s1-3 disappear and then the animation is reversed. All is good in the hood.

2) Publish again > First, rollOver the red rectangle and then press the button. s1-3 stay as they were....

 

...if you went through 1) and then within the same swf running directly to 2), it works fine also, well sometimes...but if you hover over the red first and then press, screws up...

 

thanks again Jack, I'm sure it will be something stupid as usual. Sorry about the confusion, but running the fla will do the job better I think...

Appreciated!

Link to comment
Share on other sites

Yep, the problem is that you set overwrite:1 on the S1, S2, and S3 tweens which immediately kills ALL other tweens of the same objects (including the ones you set up in that separate TimelineMax that fades their alpha). I see what you were trying to accomplish with killing any of the delayed tweens to keep them from interfering with the new ones if you rollover/out really quickly. You should control exactly which tweens you want to kill by storing them in a variable and calling kill() on them, like:

 

var t1:TweenMax;
var t2:TweenMax;
var t3:TweenMax;

function NoOver(event:MouseEvent):void {
t1 = new TweenMax(N1.S1, .5,{x:0, delay:.05, ease:Expo.easeOut})
t2 = new TweenMax(N1.S2, .5,{x:0, delay:.1, ease:Expo.easeOut})
t3 = new TweenMax(N1.S3, .5,{x:0, delay:.15, ease:Expo.easeOut})
}
function NoOut(event:MouseEvent):void {
t1.kill();
t2.kill();
t3.kill();
TweenMax.to(N1.S1, .25,{x:260, ease:Expo.easeIn});
TweenMax.to(N1.S2, .25,{x:260, ease:Expo.easeIn});
TweenMax.to(N1.S3, .25,{x:260, ease:Expo.easeIn});
}

 

You could simplify the code a bit using a TimelineLite if you want.

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.
×
×
  • Create New...