Jump to content
Search Community

stopping a tween before it starts

larryfroot test
Moderator Tag

Recommended Posts

Hello froots -

 

I have this code:

 

var myTween:TweenMax = TweenMax.to(fb_mc, 1, {colorMatrixFilter:{colorize:0xff0000, amount:1}});

 

fb_mc.onRollOver=function(){

myTween.play();

}

fb_mc.onRollOver=function(){

myTween.reverse();

}

 

Which works except that the blessed tween initaites as soon as the swf is compiled, like a rat out of an aquaduct. What must I do to kerb its enthusiasm? What will it take for this tween to tween on rollOver and not prematurely bolt out of the stable with a chillie up its a****? Any help gratefully recieved, and many thanks in advance. LF

Link to comment
Share on other sites

Ok....so I have probably mangled this beyond reason...

 

var myTween:TweenMax = new TweenMax.to(fb_mc, 1, {colorMatrixFilter:{colorize:0xff0000, amount:1}});

 

fb_mc.onRollOver=function(){

myTween.play();

}

fb_mc.onRollOver=function(){

myTween.reverse();

}

 

And now it still executes without the rollOver, but now it won't reverse the tween either. Hmmmm

 

Thanks, appreciate your time...

Link to comment
Share on other sites

fb_mc.onRollOver=function(){

myTween.play();

}

fb_mc.onRollOver=function(){

myTween.reverse();

}

 

they are both on rollover, change the reverse to on RollOut, and just stop the tween after its made, make sure you've imported the plugins and ran the plugin enabler;

 

var myTween:TweenMax = TweenMax.to(fb_mc, 1, {colorMatrixFilter:{colorize:0xff0000, amount:1}});

myTween.stop();

 

fb_mc.onRollOver=function(){

myTween.play();

}

fb_mc.onRollOut=function(){

myTween.reverse();

}

Link to comment
Share on other sites

You're using v11, right? It should be as simple as using the "paused" special property, like:

 

var myTween:TweenMax = new TweenMax(fb_mc, 1, {colorMatrixFilter:{colorize:0xff0000, amount:1}, paused:true});

fb_mc.onRollOver=function(){
   myTween.play();
}
fb_mc.onRollOver=function(){
   myTween.reverse();
}

 

It's the same things as calling pause() right after you create the tween, but I personally find it a bit more convenient.

 

Enjoy! And I'd definitely recommend using v11 if you're not already. http://blog.greensock.com/v11beta/

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