Jump to content
Search Community

TweenMax (v11.1, AS3) yoyo totally broken [SOLVED]

gmariani test
Moderator Tag

Recommended Posts

This is what I'm trying to do. I have a menu on the side with a button that pulses based on the selected button. Below is the code I'm using:

 

prevTween = TweenMax.to(mc, 0.8, { glowFilter:{alpha:1, blurX:10, blurY:10, color:0xA0CDF5, strength:1, quality:3}, yoyo:true, repeat:-1 } );

 

When you change screens I look for that old tween, kill it and start a new tween.

if (prevTween) {
	mc = prevTween.target as MovieClip;
	prevTween.kill();
	prevTween = null;
	TweenMax.to(mc, 0.8, { glowFilter:{alpha:0, blurX:0, blurY:0, color:0xA0CDF5, strength:1}, colorMatrixFilter:{brightness:1} } );
}

 

This works for about 30 seconds to a minute of looping, then it starts degrading to a simple toggle. So instead of the glow tweening nicely from nothing to on. It goes from on, to off, same with the brightness. Of course this resets as soon as I change screens, but it eventually breaks again.

 

Any idea if this is a bug or if I'm doing something wrong?

Link to comment
Share on other sites

Just upgraded from 11.1 to 11.103 and still seeing the same issue. Although (I think i saw this last time after letting it run long enough) is that it will eventually fix itself for a while. Then it will break again, and continue that cycle of running broken and working.

Link to comment
Share on other sites

Any chance you could post an FLA that demonstrates the issue? I can't seem to replicate it. I've had a yoyo-ing tween that's essentially identical to yours running for quite a long time now and it looks perfect. I wonder if there might be some logic problems in the way you're creating new tweens or something? Tough to say without being able to reproduce the problem. Help?

Link to comment
Share on other sites

This looks like a problem in the logic of your code. Let me explain:

 

A TweenMax.to() will tween the object's properties from whatever they are at the time the tween begins to the values that you describe in the tween. So let's take your example where you click repeatedly, spawning a bunch of tweens. If alpha starts at 0 and the click spawns a tween that takes it to 1 over the course of 3 seconds and successive clicks cycle through your buttons making the inactive ones go back down to 0, if you click fast enough to catch up with one of the buttons that's not finished tweening back down to zero, your new "active" tween would take it from whatever the value is currently (let's say 0.6) to 1. Since you're yoyoing, you'll see that it keeps oscilating between 0.6 and 1 whereas you were expecting it to go from 0 to 1. See the problem? So it has nothing to do with bugs in TweenMax - it's just a logic thing. You could use a fromTo() tween if you want to force the starting/ending values, or you could leave it the way it is but have your to() tween hit an onComplete that would create an yoyo'd tween going back down to 0 and up again. There are a few other ways too, but I don't want to confuse things for anyone :)

Link to comment
Share on other sites

I understand what you're getting at, and i'll try the fromTo solution. But before this, I was using TweenMax v10 with yoyo and ran into the same problem. So I did the onComplete solution and still ran into the same issue. I even reset the filter each time the glow was turned off to no avail. Which is when I decided to try upgrading to v11 to see if maybe that would fix the issue.

 

But like I said, i'll give that fromTo solution a spin and see if that fixes my problems. Thanks!

Link to comment
Share on other sites

No joy. Even clicking the button slowly (a few second gap in between 3 times) and setting fromTo I still see a flickering issue.

 

The only line I changed in from the previous FLA

 

prevTween = TweenMax.fromTo(mc, 0.8, { glowFilter:glowOff, colorMatrixFilter:brightOff }, { glowFilter:glowOn, colorMatrixFilter:brightOn, yoyo:true, repeat:-1 } );

Link to comment
Share on other sites

Stand by - you stumbled across a bug in the Flash Player. I'm implementing a workaround. Here's what it boils down to: the modulus operator reports incorrect results with certain numbers. For example, 4 % 0.8 should be 0 but Flash returns 0.799999999999! That's a pretty huge problem. I'll release a patch shortly that gets around the Flash Player bug.

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...