Jump to content
Search Community

TweenNano overwrite=false by default?

cardinal4 test
Moderator Tag

Recommended Posts

I think that documentation for TweenNano might be off, since it appears that TweenNano does not overwrite Tweens by default.

 

Example code:

package com.src
{
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;

import com.greensock.TweenNano;
import com.greensock.TweenLite;

public class Main extends Sprite 
{
	var nano:TextField;
	var lite:TextField;

	public function Main():void 
	{
		if (stage) init();
		else addEventListener(Event.ADDED_TO_STAGE, init);
	}

	private function init(e:Event = null):void 
	{
		removeEventListener(Event.ADDED_TO_STAGE, init);

		nano = new TextField();
		nano.text = "TweenNano";
		nano.y = 10;
		addChild(nano);

		lite = new TextField();
		lite.text = "TweenLite";
		lite.y = 50;
		addChild(lite);

		TweenNano.from(nano, 1, { x: 50 } );
		TweenNano.to(nano, 1, { x: 50, delay: 1 } );

		TweenLite.from(lite, 1, {  x: 50 } );
		TweenLite.to(lite, 1, {  x: 50, delay: 1 } );
	}	
}
}

 

But documentation says:

overwrite : Boolean Controls how other tweens of the same object are handled when this tween is created. Here are the options:

 

* false (NONE): No tweens are overwritten. This is the fastest mode, but you need to be careful not to create any tweens with overlapping properties, otherwise they'll conflict with each other.

* true (ALL_IMMEDIATE): This is the default mode in TweenNano. All tweens of the same target are completely overwritten immediately when the tween is created.

TweenNano.to(mc, 1, {x:100, y:200});

TweenNano.to(mc, 1, {x:300, delay:2, overwrite:true}); //immediately overwrites the previous tween

 

I only realised this when I had to switch from TweenNano to TweenLite, and realised some of my Tweens weren't playing out. I'd been taking overwrite=false for granted all along. :) This is using the latest Tween library dated 2010-04-28.

 

Btw I had a hard trouble signing up haha... Kept failing the confirmation code, not sure why, until the twentieth time a 4-digit sequence came out, with no alphabets, that I finally passed. :oops:

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