Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

How to prevent a 0 duration tween to render inmediately

Recommended Posts

Hello, i was wondering how to prevent a 0 duration tween to render his final state inmediately. I've tried setting its paused state to true, but it doesn't work. Also the inmediateRender property doesn't seem to work if it isn't a from() tween. Some example code:


package {
import com.greensock.plugins.TintPlugin;
import com.greensock.plugins.TweenPlugin;
import com.greensock.TweenLite;
import flash.display.Sprite;
import flash.events.MouseEvent;

public class Main extends Sprite {

 private var tween:TweenLite;
 public function Main():void {	
  var sprite:Sprite = new Sprite();
  sprite.graphics.drawRect(0, 0, 100, 100);
  sprite.x = 100;
				    sprite.y = 100;

  tween = TweenLite.to(sprite, 0, { tint: 0x00FF00, paused: true, inmediateRender: false } );

  addEventListener(MouseEvent.CLICK, onClick);

 public function onClick(evt:MouseEvent):void {


Thanks in advance,


Link to comment
Share on other sites

I think is worth to mention why I want to play the tween on the onClick method instead of just creating it "on the fly".


What I really want is to create a button with onRollOver and onRollOut listeners so I can play() the color tint tween on the RollOver event, and then just reverese() the tween on the RollOut.


I could actually use the AS3 native colorTransform class to do that, without using a tween, but this way is just cleaner and I was curious about why it doesn't work.

Link to comment
Share on other sites

I think in this case it makes more sense just to have a duration of .0001 or some really small non-zero value. It gets really tricky trying conceptualize and implement how a tween with no duration can be played, paused or reversed. technically it ends where it begins.

Link to comment
Share on other sites

You misspelled the special property.


BAD: inmediateRender:false

GOOD: immediateRender:false

  • Like 1
Link to comment
Share on other sites



With paused:true and immediateRender:false works as expected. The 0.001 duration also works btw.


Sorry for that misspell error. I find really useful those 0 duration tweens, because for me It's easier using tweenlite/tweenmax plugins than the core AS3 classes.

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.