Jump to content
Search Community

isTweening(obj) returns false while tween is underway

reduxdj test
Moderator Tag

Recommended Posts

I have this issue where I am trying to check if this tween is active. This code doesn't seem to work, maybe because the there's a delay set?

 

What's the best way to use overwitemanager to not overwrite this tween can you provide a small example please?

 

if (!TweenMax.isTweening(pendingLabel))

TweenMax.to(pendingLabel,.5,{alpha:1,yoyo:true,repeatDelay:.6,repeat:-1});

 

Thanks,

Patrick

Link to comment
Share on other sites

I'm not sure I understand the question. I just tested isTweening() and it seems to work perfectly. It's failing for you?

 

A more efficient way of doing the conditional logic would be:

 

var tween:TweenMax;
function myFunction():void {
   if (tween == null) {
       tween = TweenMax.to(pendingLabel, .5, {alpha:1, yoyo:true, repeatDelay:.6, repeat:-1});
   }
}

Link to comment
Share on other sites

  • 2 months later...

hola,

 

seems like isTweening doesn't work in combination with allTo or allFrom, speaking about animating objects in arrays.

 

if (!TweenMax.isTweening(stages)) {
TweenMax.allTo(stages, 2, {
	x:"400"
});
}

 

maybe that was the problem of reduxdj? D:

 

regards

 

soelen

Link to comment
Share on other sites

sure, it works with any/all tweens even if they're created in allTo() or allFrom() methods. But keep in mind that you wouldn't pass an array to the isTweening() method - it's the object that is tweening. If you're experiencing problems with isTweening(), would you please create a sample FLA that demonstrates the issue and post it here? The simpler the better.

Link to comment
Share on other sites

Like I said, you should NOT be passing an array to TweenMax.isTweening(). That's precisely what you did, though. isTweening() checks to see if a particular object is being tweened, not any of the objects inside of an array. You could easily accomplish what you want with a custom function of your own, like:

 

function isAnyTweening(a:Array):Boolean {
var i:int = a.length;
while (--i > -1) {
	if (TweenMax.isTweening(a[i])) {
		return true;
	}
}
return false;
}

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