tweenManager class

Main class of MovieClip Tweening prototypes, prototypes only parses arguments (and does not store any variables to MovieClip) to instance of class named $tweenManager

Properties

autoStop - Boolean, default is false.

Set true if you want all tweens in the target to stop whenever a new tween is added.(In prior releases, autoStop only affected the new properties tweened.) For example:

_global.$tweenManager.autoStop = true;
my_mc.slideTo(100,100,1);
my_mc.tween('_x',200,1);// stops both _x and _y in the clip

updateInterval - Number, default 0. (getter/setter)

Normally tweens are executed onEnterFrame, similar to Penner's Tween class. (Frame-based updates tend to run much more smoothly than setInterval-based updates in Flash.)

To force $tweenManager to run on a setInterval instead, set the updateInterval property to a millisecond value. If reset to 0 updates will revert to onEnterFrame.

_global.$tweenManager.updateInterval = 100;


controllerDepth - Number, default 6789. (getter/setter)

The onEnterFrame used for updates (see updateInterval above) is broadcast from a controlling clip called "_th_", created on depth 6789 of the root timeline by default. If this depth is inconvenient (for example when using getNextHighestDepth in the root timeline), you may set the depth using this property. Example:

_global.$tweenManager.controllerDepth = 0; // moves clip to depth 0

Please note that although it is possible to use negative depths (at times be the most convenient location for this type of clip), you should not do so if looping the main timeline.

broadcastEvents - boolean, default false. When true, MovieClips and TextFields broadcast events (based on older AsBroadcaster model). Events should be subscribed to via the MovieClip or TextField being tweened.

onTweenStart (evtObj)
onTweenUpdate (evtObj)
onTweenEnd (evtObj)
onTweenInterrupt (evtObj)
- broadcast when any property's tween is stopped or overwritten.

The evtObj argument contains the properties:

example:

_global.$tweenManager.broadcastEvents = true; 
my_obj = {};
my_obj.onTweenStart = function(){
	trace('my_obj onTweenStart');
} 
my_obj.onTweenUpdate = function(){
	trace('my_obj onTweenUpdate');
} 
my_obj.onTweenEnd = function(){
	trace('my_obj onTweenEnd');
} 
my_second_obj = {};
my_second_obj.onTweenEnd = function(){
	trace('my_second_obj onTweenEnd');
} 
my_mc.onTweenEnd = function(o:Object){
  trace('my_mc tween ended for props: ' + o.props)
} 
my_mc.addListener(my_obj);
my_mc.addListener(my_second_obj);
my_mc.addListener(my_mc);
my_mc.tween('_x',200,1);
my_mc.tween('_y',200,2);

Methods:

pauseAll() : pauses all runing and delayed tweens

unPauseAll() : unpauses all runing and delayed tweens

stopAll() : stops all running and delayed tweens

example usage: _global.$tweenManager.pauseAll();

Note: these same 'global' methods can now also be accessed by calling the pauseAllTweens(), unpauseAllTweens() and stopAllTweens() shortcut methods on any MovieClip or Textfield.

Tips:

I some cases when you upgrade from older version you may have trouble accessing new features, or receive undexpected compiler errors. To check the version being run by Flash, use the command:

trace($tweenManager);

If you see [object Object] or [AS2 tweenManager [version nr]], and nr is lower than your installed version, that means that an older version of tweenManager is loaded. To fix this issue (caused by automatic caching of classes), you must delete the specific precompiled class file (*.aso), or simply delete the entire aso directory which will force Flash to recompile all classes on publish. To find the directory or file, look here:

WinXP:
C:\Documents and Settings\[username]\Local Settings\Application Data\Macromedia\Flash MX 2004\[language]\Configuration\Classes\aso\ zigo.tweenManager.aso

Macintosh:
[username]:Library:Application Support:Macromedia:Flash MX 2004:en:Configuration:Classes:aso:zigo:tweenManager.aso