Jump to content
Search Community

Ignore Tween if Tween taking place.

mrEmpty test
Moderator Tag

Recommended Posts

Hello.

 

Can I have a new call to tween ignored if a tween is already happening?

 

If I have a movie clip I want to move by 100 pixels each time I click on it for example, but I double click on it, it'll move 100 pixels plus the pixels it moved when I first clicked on it. That's as expected of course.

 

Now I could remove the event listener then run an onComplete to add it again, but that seems ugly and I'm sure there must be a nicer way. I tried grabbing the currentProgress to see if it's value was above 0, if it was ignore the call to tween, otherwise go ahead. But again, it seemed wrong so I thought I'd ask.

 

Cheers.

Link to comment
Share on other sites

Hi mrEmpty,

Yes Greensock's TweenMax has a method calledisTweening which you can use on your mc.

 

If I've understood you correctly you can use it like this as a basic example:

 

if (!TweenMax.isTweening(mc))
{TweenLite.to(mc,1,{x:"100"});}

 

You could even put it inside the function you call from your EventListener.

 

function move100(e:MouseEvent):void{
if (!TweenMax.isTweening(e.currentTarget)){
TweenLite.to(e.currentTarget,1,{x:"100"});}
};

Link to comment
Share on other sites

Hello.

 

Thanks for the reply. I had tried isTweening in almost the exact what you wrote out, and it did nothing (and threw no errors). I decided to try compiling the code on a second system with CS5 (not 5.5) and 10.6 (instead of 10.7) and it worked fine. So it appears the issues with Flash CS5.5 on OS X Lion are deeper than I originally thought. Sadly I can't roll back, so I'll be using Flashbuilder for the time being.

 

Or installing bootcamp!

 

I'm really concerned though as to why AS3 compiles differently between the two systems and why I get no errors on Lion when Sow Leopard threw up some things I needed to fix. I though Flashbuilder and Flash would compile in the same way, but evidently they don't.

 

Which is worrying.

 

But anyway, thanks again. :)

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