Main Page | Package | Index | Help

com.mosesSupposes.fuse

class ZigoEngine

Object
  |
  +--com.mosesSupposes.fuse.ZigoEngine


class ZigoEngine
extends Object

A robust central processing engine for all scripted tweens in a swf published to AS2.

Usage:
Your project can be prepared to use ZigoEngine in these ways:
  • Simply import this class and begin using static methods like doTween.
    - You may then optionally extend the engine's capabilities using register.
  • Or, use simpleSetup to add tweening shortcuts like alphaTo to MovieClips, Buttons and TextFields.

Extending prototypes is entirely optional in this version - all Shortcut functionality is excluded from the core engine class.

Events dispatched by ZigoEngine (see addListener for more info):
  • onTweenAdd
  • onTweenInterrupt
Events dispatched by individual target objects (see ZManager for more info):
  • onTweenStart
  • onTweenUpdate
  • onTweenEnd


Author:
Moses Gunesch / MosesSupposes.com / ZigoEngine based on concepts by Ladislav Zigo, Zeh Fernando

Version:
2.1


Field Summary

public static
AUTOSTOP: Boolean = false
(Legacy) Option to stop all tweening props in target as a new tween is added.

public static
DURATION: Number = 1
Default tween duration if unspecified.

public static
EASING: Object = "easeOutQuint"
Default easing if unspecified.

public static
OUTPUT_LEVEL: Number = 1
Controls how much feedback the engine outputs, helpful for debugging.

public static
ROUND_RESULTS: Boolean = false
If set true the engine always rounds its math (helpful with pixelfonts).

public static
SKIP_LEVEL: Number = 1
(Advanced) Sets default engine behavior for situations where tweens fail to affect a visible change or have no duration.

public static
TIME_MULTIPLIER: Number = 1
Debug feature: Skips, speeds up, or slows all tweens globally. All time values in ZigoEngine and Fuse are multiplied by this number.

public static
VERSION: String = FuseKitCommon.VERSION + ", ZigoEngine based on concepts by Ladislav Zigo, laco.wz.cz/tween"
Enables kit version to be retrieved at runtime or when reviewing a decompiled swf.

Method Summary

public static
addListener ( handler: Object ): Void
(Advanced) Use this method to add a listener for "onTweenAdd" and "onTweenInterrupt" events, which are broadcast directly by the engine.

public static
deinitialize ( target: Object ): Void
(Advanced) Clears targets from being used with the engine.

public static
doShortcut ( targets: Object, methodName: String ): String
An alternative to doTween that accepts Shortcut syntax. Requires registration of the Shortcuts class.

public static
doTween ( targets: Object, props: Object, endvals: Object, seconds: Number, ease: Object, delay: Number, callback: Object ): String
Generates and immediately begins one or more property-tweens running on one or more targets.

public static
ffTween ( targs: Object, props: Object, suppressEndEvents: Boolean ): Void
Fast-forwarding a tween ends it and removes it from the engine.

public static
getColorKeysObj ( targOrTransObj: Object ): Object
(General) Provides readings by keyword for a target object or Flash7-style color-transform object.

public static
getColorTransObj ( type: String, amt: Number, rgb: Object ): Object
(General) Generates a generic Flash7-style color-transform object with props like ra, etc., by keyword.

public static
getControllerDepth ( ): Number
Depth of the ZigoEnginePulse clip.

public static
getTweens ( targ: Object ): Number
Returns the number of tweens active in a target object.

public static
getUpdateInterval ( ): Number


public static
initialize ( target: Object ): Void
(Advanced) Prepares targets for use with engine.

public static
isPlaying ( ): Boolean
Returns true if the engine contains tweens and is running updates on a pulse

public static
isTweening ( targ: Object, prop: String ): Boolean
Test if a target and optionally a specific property is being handled by the engine.

public static
isTweenLocked ( targ: Object ): Boolean
Locks tweens and prevents from running until tween is unlocked.

public static
isTweenPaused ( targ: Object, prop: String ): Boolean
Test whether any or a specific property is paused in a target object

public static
lockTween ( targ: Object, setLocked: Boolean ): Void
Locks a target to prevent tweens from running until target is unlocked.

public static
pauseTween ( targs: Object, props: Object ): Void
Pause one or more tweens

public static
register ( classReference: Function ): Void
An optional setup command that registers additional classes for use with the ZigoEngine.

public static
removeListener ( handler: Object ): Void
Remove a listener for onTweenAdd or onTweenInterrupt events.

public static
removeTween ( targs: Object, props: Object ): Void
Remove specific or all tweening properties from specific or all tweening targets in engine.

public static
resumeTween ( targs: Object, props: Object ): Void
Unpause one or more tweens.

public static
rewTween ( targs: Object, props: Object, pauseFlag: Boolean, suppressStartEvents: Boolean ): Void
Rewinds and either pauses or restarts one or more tweens

public static
setColorByKey ( targetObj: Object, type: String, amt: Number, rgb: Object ): Void
(General) Color-transforms a target by keyword.

public static
setControllerDepth ( depth: Number ): Void
Creates a clip in the _root timeline called "ZigoEnginePulse" or sets its depth

public static
setUpdateInterval ( time: Number ): Void
When set, the engine will run on a setInterval pulse instead of a frame pulse.

public static
simpleSetup ( shortcutsClass: Function ): Void
An alternative setup command that extends prototypes with shortcuts like alphaTo.

public static
skipTweenTo ( seconds: Number, targs: Object, props: Object ): Void
Jumps a tween to a specific point in its duration.

public static
unpauseTween ( targs: Object, props: Object ): Void
Legacy - see resumeTween



Field Documentation

AUTOSTOP

public static var AUTOSTOP: Boolean = false
(Legacy) Option to stop all tweening props in target as a new tween is added.

DURATION

public static var DURATION: Number = 1
Default tween duration if unspecified.

Usage:
// set once at beginning of program to change engine default setting.
ZigoEngine.DURATION = .5;

EASING

public static var EASING: Object = "easeOutQuint"
Default easing if unspecified.

This default is hardcoded in the engine and doesn't require that PennerEasing is registered. However you will need to register that class with the engine if you wish to set this property to a similar string like "easeOutQuad". You may also set this property to any standard easing function (like mx.transitions.easing).

Usage:
// Example with a style from PennerEasing
ZigoEngine.register(PennerEasing);
ZigoEngine.EASING = 'easeInOutExpo';
 
// or - Alternate example with an mx style
import mx.transitions.easing.Elastic;
ZigoEngine.EASING = Elastic.easeOut;

OUTPUT_LEVEL

public static var OUTPUT_LEVEL: Number = 1
Controls how much feedback the engine outputs, helpful for debugging.

Usage:
            ZigoEngine.OUTPUT_LEVEL = 2;
            
            <ul>
            <li>0 = no traces,</li> 
            <li>1 = normal errors & warnings</li>
            <li>2 = additional output</li>
            </ul> 

ROUND_RESULTS

public static var ROUND_RESULTS: Boolean = false
If set true the engine always rounds its math (helpful with pixelfonts).

Degradation in animation and performance is minor with this feature enabled. Hence it was left a global toggle with the assumption that it should only be set true for projects requiring rounding.

Usage:
// set once at beginning of program to change engine default setting.
ZigoEngine.ROUND_RESULTS = true;

SKIP_LEVEL

public static var SKIP_LEVEL: Number = 0
(Advanced) Sets default engine behavior for situations where tweens fail to affect a visible change or have no duration.

Usage:
// set once at beginning of program to change engine default setting.
ZigoEngine.SKIP_LEVEL = 2;
No-duration tweens:
Tweens with a 0-second duration set the property immediately at the time of the tween call, or after any delay.
This behavior has advantages and disadvantages. It is recommended that you purposefully use 0-second tweens to set properties that are handled by the engine at any time in your program, since this will effectively stop any potentially running tweens on that property. (Trying to set a property while it is being tweened usually has no effect.) However in some dynamic programs you may want tweens that end up having no duration to also skip their delay and/or callbacks and events - this can be controlled with SKIP_LEVEL.

No-change tweens:
Tweens at times end up being generated that affect no visual change. Normally the ZigoEngine operates under its legacy behavior, which is to run such tweens regardless. This can be good (the program's sequence will continue on a schedule) or bad (the tween is essentially invisible and will fire callbacks and events on update and end, which may cause confusion). In some cases you may want to skip past tweens that don't do anything visually.

The SKIP_LEVEL default, as well as the per-tween skipLevel parameter (see doTween) enable you to control the engine's behavior in these situations more accurately:
  • 0= Default.
    No-change tweens are run with their full duration, delay, and callbacks/events. No-duration tweens set the property and execute all callbacks and events immediately or after a delay.
  • 1= Skip no-change tweens.
    Tweens that affect no change are discarded (both delay and duration are ignored). Callbacks/events are fired immediately. No-duration tweens ignore delay and set properties immediately.
  • 2= Do not fire events or callbacks for no-change or no-duration tweens.
    No-change tween calls are entirely ignored. No-duration tweens ignore delay and set properties immediately.

To review what property tweens were successfully added, doTween returns a formatted list.

TIME_MULTIPLIER

public static var TIME_MULTIPLIER: Number = 1
Debug feature: Skips, speeds up, or slows all tweens globally. All time values in ZigoEngine and Fuse are multiplied by this number.

Affects all durations, delays, and time-based triggers kit-wide.

A reminder message like [ ZigoEngine.TIME_MULTIPLIER: 20% ] is sent to output each time the setting is changed, upon the start of the next tween (unless ZigoEngine.OUTPUT_LEVEL has been set to 0).

Set to 0 to fast-forward through all animation. Unlike Fuse.fastForward, all callbacks and events associated with tweens are still fired, durations are simply set to 0. Note that based on SKIP_LEVEL settings this may alter some behaviors in your program.

Values between 0 and 1 cause tweens to run faster than their specified duration, on a percentage basis. For example a setting of .25 would reduce durations to 25% of their actual values, making tweens run 1-1/2 times faster.

Any value greater than 1 will cause tweens to run in slow motion by increasing durations on a percentage basis. For example a setting of 2 would force tweens to run at half speed.

Usage:
// set once at beginning of program to change engine default setting.
ZigoEngine.TIME_MULTIPLIER = .5; // run all tweens at double-speed.

(advanced) Note that for more complex debugging of Fuse sequences you may want to set this property inline during the sequence. Example:
var testMode:Boolean = true;
function setTimeMultiplier(mult:Number):Void {
	if (testMode==true) ZigoEngine.TIME_MULTIPLIER = mult;
}
var f:Fuse = new Fuse();
f.scope = this;
// start sequence skipping through all tweens..
f.push({ func:setTimeMultiplier, args:0 });
// later in sequence return to normal speed..
f.push({ func:setTimeMultiplier, args:1 });
// etc.

VERSION

public static var VERSION: String =FuseKitCommon.VERSION + ", ZigoEngine based on concepts by Ladislav Zigo, laco.wz.cz/tween"
Enables kit version to be retrieved at runtime or when reviewing a decompiled swf.

Usage:
trace(ZigoEngine.VERSION); // if the version is incorrect, clear your ASO cache.


Method Documentation

addListener

public static function addListener (handler: Object): Void
(Advanced) Use this method to add a listener for "onTweenAdd" and "onTweenInterrupt" events, which are broadcast directly by the engine.

Usage:
These events are special in that they are dispatched directly by the ZigoEngine class, unlike target-events such as onTweenEnd (see: ZManager for more info).

The "onTweenAdd" event is fired when any doTween call is made, and passes the final parameters that will be sent to the internal ZManager instance in the following order:
  • An array of tween targets
  • An array of property strings generated by the ZManager.paramsObj method.
    Note: _scale and _size are split into movieclip properties, and duplicate properties are stripped, with the exception of overlapping _fade / _alpha and overlapping color-transform tweens.
  • A corresponding array of tween end-values for each validated property
  • A validated numerical tween duration in seconds
  • A valid easing function
  • A validated numerical delay in seconds
  • A specially-formatted and validated callback object generated by the FuseKitCommon.parseCallback method.
var myListener:Object = {
    onTweenAdd:function(targets:Array, props:Array, endvals:Array, 
                        seconds:Number, ease:Function, 
                        delay:Number, callback:Object):Void {
        trace("ZigoEngine is adding a tween:");
        trace(" -targets:"+targets.join(","));
        trace(" -props:"+props.join(","));
        trace(" -endvals:"+endvals.join(","));
        trace(" -seconds:"+seconds);
        // (easing function is never undefined)
        trace(" -delay:"+delay);
        trace(" -has callback:"+Boolean(callback.start.f!=null 
                                        || callback.upd.f!=null 
                                        || callback.end.f!=null));
    }
};
ZigoEngine.addListener(myListener);

The "onTweenInterrupt" event is fired in the following situations, and passes several additional parameters including "during" which can provide a clue as to which situation caused the interruption.
  • Another tween call overwrote one or more property tweens in progress. during = "add".
  • A removeTween call stopped one or more tweens in progress. during = "remove".
  • A target goes missing, for instance if a MovieClip was removed during a tween, or a target is deinitialized from the engine before its tweens complete. during = "update".
This ensures the event is fired even when targets go missing and are thus unable to dispatch the event. To aid in tracking targets in that situation, the internal __zigoID__ property for each target is also passed in the event object. Any initialized/tweening target contains this read-only property, making it possible to advance-query then later identify targets after they're removed. Missing targets can be further identified by the "target" parameter of the event object (normally a reference to the actual tween target), which will be sent as a string like [MISSING:"clip1_mc"].
var myListener:Object = {
	onTweenInterrupt:function(o:Object):Void {
		trace("Interruption detected:");
		trace(" -during cycle:"+o.during);
		trace(" -target:"+o.target);
		trace(" -target id:"+o.__zigoID__);
		trace(" -properties interrupted:"+(o.props).toString());
	}
};
ZigoEngine.addListener(myListener);
ZigoEngine.doTween(my_mc,"_alpha",0,2);

// click the mouse during the tween to receive the event.
function onMouseDown():Void {
	my_mc.removeMovieClip();
}
  

Parameters:
handler
the function or object that should be called

deinitialize

public static function deinitialize (target: Object): Void
(Advanced) Clears targets from being used with the engine.

Removes AsBroadcaster functionality (and tweening shortcuts if the Shortcuts class was registered) from any object previously initialized using initialize.

Parameters:
target
One or more targets to initialize, or nothing/null to deinitialize base prototypes (for example to undo simpleSetup)
See also:

doShortcut

public static function doShortcut (targets: Object,
 methodName: String): String
An alternative to doTween that accepts Shortcut syntax. Requires registration of the Shortcuts class.

This idea thanks to Yotam Laufer. Example:
ZigoEngine.doShortcut(my_mc, 'scaleTo', 200, 1, 'easeOutQuad');
See ZigoEngine introduction for instructions on registering Shortcuts to enable this feature.

Parameters:
targets
Tween target object or array of target objects
methodName
The shorcut as a string, such as "alphaTo", followed by parameters that follow that shortcut's format.
Returns:
A comma-delimited string of props successfully added. When multipe targets were passed, a pipe-delimited series is returned to enable verification of individual properties per target.

doTween

public static function doTween (targets: Object,
 props: Object,
 endvals: Object,
 seconds: Number,
 ease: Object,
 delay: Number,
 callback: Object): String
Generates and immediately begins one or more property-tweens running on one or more targets.

ZigoEngine.doTween(my_mc, '_x,_y', [100,150], 1, Strong.easeInOut);
Fuse-style Object Syntax may also be used if the FuseItem class is registered:
ZigoEngine.doTween({ target:my_mc, start_alpha:0, y:150, ease:Strong.easeInOut });

Parameters:
targets
Tween target object or array of target objects
(All properties listed in the following parameter are tweened on all targets specified.)
props
String like "_x", comma-delimited list of properties like "_x,_y", or Array of properties like ["_x","_y"].
The engine accepts any existing property in the target including custom variables, and the following special properties:
  • _bezier_ Object {x:,y:,controlX:,controlY:} generates a curved motion path.
    • Relative (string) values supported for all parameters
    • Only two properties are needed to tween a curve
    • Example, slides right / arcs up:
      ZigoEngine.doTween(clip1, "_bezier_", {x:"100",controlY:"-50"});
  • _brightness -100=black, 0=normal, 100=white
  • _brightOffset Burn effect. -100=black, 0=normal, 100=white
  • _colorReset 100 = fully restores target's colors to normal.
  • _colorTransform Generic object in Flash7 transform format: {ra:,rb:,etc.}
  • _contrast 0=gray, 100=normal, 200=high-contrast, higher=posterized
  • _fade Like _alpha + _visible. Typically used with 0 or 100 values.
    • Visibility turned off when tween ends if value is under 50
    • Visibility turned on when any _fade tween starts
  • _frame Tweens a target MovieClip's timeline to a frame, with easing.
  • _invertColor 100 = Photo-negative effect
  • _scale Sets _xscale and _yscale to the same value.
  • _size Sets _width and _height to the same value.
  • _tint Accepts various formats:
    • 0x000000 and "#000000" hex formats
    • null (full color reset)
    • Object with tint & percent properties:
      {tint:Number/null/hexString, percent:Number/String}.
  • _tintPercent Value range 0-100
When FuseFMP is registered, a large number of BitmapFilter properties are tweenable:
  • Blur_blurX, etc. Format follows the convention short-filtername+"_"+filter property.
endvals
tween end-value or Array of corresponding end-values. A single end-value can be used with multiple properties.
Accepts various formats:
  • Number A normal absolute end-value. Tweening _x to 10 in the main timeline moves it to 10px from the left edge of the stage.
  • String - Relative values: Passing a string version of a number like "10" or "-10" calculates end-value as relative to the start position of the tween.
    Examples: Tweening _x to "10" moves the clip 10px to the right of its current position.
    Tweening _rotation to a negative string value like "-90" affects a counter-clockwise spin.
  • Bezier, tint, or color-transform object See _bezier_, _colorTransform, _tint properties above.
  • Multi-value Object or Array - (Advanced) A new feature is the ability to directly tween multiple values in an Object or Array. Note that like any custom variables these objects must exist prior to tweening and have their properties set to numerical values in advance.
    var myObj:Object = {x:0,y:0,z:0}; ZigoEngine.doTween(this, "myObj", { x:1, y:2, z:3 });

    Note also that because this parameter already accepts an Array for multiple end-values, you must wrap it in a second Array:
    var myArray:Array = [ 0, 0 ]; ZigoEngine.doTween(this, "myArray", [[10,20]]);
  • Colors Array - (Advanced) Tweening a generic array of color values can help with situations like tweening the properties of a gradient fill that's redrawn on tween update. Any array whose name contains 'colors' (case is ignored) will be handled by the engine as an array of color values. Note that the internal colortransforms are not applied to any target, simply updated within the array.
    Example: ZigoEngine.doTween(this, "myColors", [[ 0x000000, 0xFFFFFF ]], 1, null, 0, { scope:this, updfunc:'redrawGradient' });

(advanced) Example of tweening a Matrix object to move and skew a clip (Flash 8 required):
import com.mosesSupposes.fuse.*;
import flash.geom.Matrix;
import flash.geom.Transform;
ZigoEngine.register(PennerEasing);
var myMatrix:Matrix = new Matrix();
var boxTrans:Transform = new Transform(box);
function applyMatrixTrans():Void { boxTrans.matrix = myMatrix; }
ZigoEngine.doTween(	this, "myMatrix", {a:.5, c:.5, tx:200 },
1, 'easeOutBounce', 0, {updfunc:applyMatrixTrans});
seconds
tween duration. If nothing is passed, defaults to ZigoEngine.DURATION.
ease
Accepts a number of formats based on which features are registered:
  • function - like mx.transitions.easing.Strong.easeInOut
  • shortcut-string - "easeInOutQuint" or any other function name from PennerEasing
  • Array generated by the Custom Easing Tool. (This special panel is installed into Flash when you install the Fuse Kit v2.1 or later MXP extension). Note that the CustomEasing class must be registered to use this feature.
  • null or nothing - defaults to ZigoEngine.EASING if set, or PennerEasing.easeOutQuint, which is hardcoded in the engine as a default fallback.
delay
seconds to wait before performing the tween. Start callback and onTweenStart event are fired at end of delay.
callback
function, string, or object

The kit tries to parse callbacks in many formats. Note that for callbacks to execute successfully in many cases it is crucial that a "this" scope is defined in which to locate and fire the function. Although the engine often successfully locates your callbacks, the recommended option is Callback Object, which is the most stable and flexible, demands the least parsing, and allows you to most clearly define scope, as well as providing additional tween options.
  1. Function
    ZigoEngine.doTween(mc,"_x",100,1,"linear",0, myCallback);
    • Reference: myCallback
    • String: "myCallback"
    • Inline: function(){ ... }
    • Delegate: mx.utils.Delegate.create(....) - adds scope
  2. Easyfunc String (Shortcuts must be registered to use this feature)
    ZigoEngine.doTween(mc,"_x",100,1,"linear",0, "this.myCallback(true);");
    • example: "trace('The tween is finished');"
    • Supports complex scope and many datatypes for argument params:
      "myscope.myscope.myfunc(true,1,'hello',{paramA:1,paramB:false,[0,1],null);"
    • You may also use easyfunc strings in callback objects (below) for start, update and end callbacks.
    • Limitations: Easyfunc strings are not a good option for class authoring. They work well when coding in frames of the _root timeline and enhance the Shortcuts paradigm. When a callback resides in a frame of a subclip's timeline, the easyfunc string should contain an absolute path to the function. For instance if clip1 exists in the _root timeline and houses the function myCallback, use "clip1.myCallback();".

      A somewhat impractical workaround for class authors is to set a local reference like var t:MyClass=this; preceding an easyfunc like "t.myMethod();", which exploits scope-chain during eval. Again, Callback Objects are recommended for OO coders.
  3. Callback Object ZigoEngine.doTween(clip1,"_x","100",1,"easeOutQuad",0, {scope:this, func:"myCallback", args:true});
    ZigoEngine.doTween(clip2,"_x","100",1,"easeOutQuad",0, { cycles:2 }); // yoyo back once
    • func Function, string name of function, or Easyfunc string like "myClip.doSomething(true);" (Shortcuts must be registered to use the Easyfunc feature.)
    • scope The "this" object in which to locate and fire the callback. Not always required but recommended if the engine cannot locate the callback or fires the wrong function.
    • args One argument or an array of arguments to pass to the func callback.
    • startfunc Callback fired after any delay and as tween is starting. Supports various formats - see func above.
    • startscope Specific scope for the startfunc callback. If not defined, the scope property will be used.
    • startargs One argument or an array of arguments to pass to the startfunc callback.
    • updfunc Callback fired on engine pulse as the tweens in the action are updated. Accepts various formats - see func above.
    • updscope Specific scope for the updfunc callback. If not defined, the scope property will be used.
    • updargs One argument or an array of arguments to pass to the updfunc callback.

    Additional callback object parameters
    • cycles Tweens back and forth between start and end.
      0 or "LOOP" = infinite cycles, default = 1, 2 or more to specify cycles.
    • skipLevel 0,1, or 2. An advanced behavior setting for cases where tweens fail. See SKIP_LEVEL for details.
      Including this paramter in a callback object overrides the engine default on a per-tween basis.
    • extra1 Optional fifth parameter sent to easing method. Elastic easing amplitude or Back easing overshoot.
    • extra2 Optional sixth parameter sent to easing method. Elastic easing period.
    • roundResults Overrides the class setting ROUND_RESULTS for an individual tween. Useful for instance, if the class default is true but you need to execute a tween such as DropShadow_alpha which requires a 0-1 range.
    • easyfunc Removed from kit. func, startfunc, updfunc parameters now accept easyfunc strings (see func above).
Returns:
A formatted string:
The engine reports which properties have been added to its active tween list by returning a comma-delimited string of just the properties that were successfully added, such as "_x" or "_x,_y". These may occasionally differ from what was tweened, such as "_width,_height" when "_size" was tweened.

If multiple targets are passed to the engine, a pipe-delimited series of properties is returned in target order, which enables granular review of whether specific properties for each target.
var results:String = ZigoEngine.doTween([clip1,clip2,clip3],"_scale",100,null,0,{skipLevel:1});
// results: "_xscale,_yscale||_xscale,_yscale"
// because clip2's scale was already set to 100 and the skipLevel is set to skip no-change tweens.

ffTween

public static function ffTween (targs: Object,
 props: Object,
 suppressEndEvents: Boolean): Void
Fast-forwarding a tween ends it and removes it from the engine.

Usage:
ZigoEngine.doTween(clip1, "_x, _xscale, _alpha", ["100", 200, 0], 1, "easeInOutExpo");
// during tween, fast-forward just the slide and scale but allow the fade-out to run:
ZigoEngine.ffTween(clip1, "_x, _scale");
 
// fast-forward all tweens in multiple targets
ZigoEngine.ffTween([clip2,clip3,clip4]);

Parameters:
targs
a single target object, array of targets, or FuseKitCommon.ALL for every active target
props
a property string, array of property strings, null or nothing for all props, FuseKitCommon.ALLCOLOR for any active color transform
suppressEndEvents
if true is not passed, engine will fire 'onTweenEnd' event and any end-callbacks associated with the tween

getColorKeysObj

public static function getColorKeysObj (targOrTransObj: Object): Object
(General) Provides readings by keyword for a target object or Flash7-style color-transform object.

Inherent rounding errors are common! Especially when percentages are below 50. Even .tintString hex values may differ slightly.

Parameters:
targOrTransObj
target object or Flash7-style color-transform object with props like ra, etc.
Returns:
object may contain props brightness, brightOffset, contrast, invertColor, tint, tintPercent, and tintString

getColorTransObj

public static function getColorTransObj (type: String,
 amt: Number,
 rgb: Object): Object
(General) Generates a generic Flash7-style color-transform object with props like ra, etc., by keyword.

Parameters:
type
String "brightness", "brightOffset", "contrast", "invertColor", or "tint"
amt
Percentage, can be negative in some cases
rgb
For "tint", a color value in 0x000000 or "#000000" format

getControllerDepth

public static function getControllerDepth (): Number
Depth of the ZigoEnginePulse clip.

Returns:
numeric depth in _root

getTweens

public static function getTweens (targ: Object): Number
Returns the number of tweens active in a target object.

Parameters:
targ
target tween passed to determine if active, or FuseKitCommon.ALL for every active target
Returns:
number of active tweens, which may be paused or playing

getUpdateInterval

public static function getUpdateInterval (): Number
Returns:
Number set using setUpdateInterval, or undefined if unset.

See also:

initialize

public static function initialize (target: Object): Void
(Advanced) Prepares targets for use with engine.

This method is never needed when extending prototypes with simpleSetup. It can be used to initialize specific targets to accept listeners prior to tweening - see ZManager for an example. If the Shortcuts class was passed to register, this method also copies all tweening shortcuts to targets.

Parameters:
target
One or more targets to initialize.
See also:

isPlaying

public static function isPlaying (): Boolean
Returns true if the engine contains tweens and is running updates on a pulse

isTweening

public static function isTweening (targ: Object,
 prop: String): Boolean
Test if a target and optionally a specific property is being handled by the engine.

Parameters:
targ
a single target object to test
prop
a specific property string
Returns:
true if a matching active tween is found, which may be paused or playing

isTweenLocked

public static function isTweenLocked (targ: Object): Boolean
Locks tweens and prevents from running until tween is unlocked.

Parameters:
targ
Object to lock
Returns:
locked value

isTweenPaused

public static function isTweenPaused (targ: Object,
 prop: String): Boolean
Test whether any or a specific property is paused in a target object

Usage:
if (ZigoEngine.isTweenPaused(clip1,"_alpha")==true) { ... }

Parameters:
targ
a single target object to test
prop
props a property string, null or nothing for any property, FuseKitCommon.ALLCOLOR for any active color transform
Returns:
paused value

lockTween

public static function lockTween (targ: Object,
 setLocked: Boolean): Void
Locks a target to prevent tweens from running until target is unlocked.

A warning message is thrown if your program attempts to call a tween on a locked target.

Usage:
Accepts only one target at a time.

FuseKitCommon.ALL is not accepted by lockTween, because that would only affect targets currently being tweened in the engine. (In a case where you want to stop or pause all running tweens use pauseTween(FuseKitCommon.ALL) or removeTween(FuseKitCommon.ALL). The lockTween method is used to preset targets that usually are not currently being tweened in the engine. For more complex scenarios you should build an array of targets you need to affect, then use a for-loop to call the method on each one individually.
// example of how you could manage a block of targets in your program with lock/unlock
var lockableTargs:Array = [clip1,clip2,clip5];
function toggleTweenLock(setLocked:Boolean):Void {
	for (var i:String in lockableTargs) ZigoEngine.lockTween(lockableTargs[i], setLocked);
}

Parameters:
targ
Object to lock
setLocked
locked value
See also:

pauseTween

public static function pauseTween (targs: Object,
 props: Object): Void
Pause one or more tweens

Usage:
ZigoEngine.doTween(clip1, "_x, _xscale, _alpha", ["100", 200, 0], 1, "easeInOutExpo");
// during tween, pause just the slide and scale but allow the fade-out to run:
ZigoEngine.pauseTween(clip1, "_x, _scale");
 
// pause all engine tweens in the swf
ZigoEngine.pauseTween(FuseKitCommon.ALL);

Parameters:
targs
a single target object, array of targets, or FuseKitCommon.ALL for every active target
props
a property string, array of property strings, null or nothing for all props, FuseKitCommon.ALLCOLOR for any active color transform

register

public static function register (classReference: Function): Void
An optional setup command that registers additional classes for use with the ZigoEngine.

This setup command should only be called once at the beginning of your program. Use either this or simpleSetup, not both. The difference is that register links additional classes to the engine without altering base prototypes.
import com.mosesSupposes.fuse.*;
ZigoEngine.register(PennerEasing, Fuse, FuseFMP);
Note that to keep filesize to a minimum you should only register the features you intend to use. Use publish settings to "omit trace actions" to further reduce filesize.

Parameters:
classReference
Pass any of the following classes (all are optional):
  • Shortcuts Enables doShortcut, 'easyfunc' callback parsing, and the option to copy / remove shortcuts on any target or prototype manually using initialize. See Shortcuts
  • PennerEasing Enables shortcut strings like "easeOutQuad" to be used with the engine. See PennerEasing
  • Fuse Enables Fuse for animation sequencing. Note that if animation won't be sequenced you do may simply import and use Fuse without ZigoEngine. See Fuse
  • FuseFMP Enables shortcut strings like DropShadow_distance to be tweened in the engine. See FuseFMP
  • FuseItem Enables Fuse-style Object Syntax to be used with the ZigoEngine.doTween. Note that Fuse does not need to be registered to use this feature. See FuseItem

removeListener

public static function removeListener (handler: Object): Void
Remove a listener for the onTweenAdd or onTweenInterrupt events.

Parameters:
handler
the function or object that should be called

removeTween

public static function removeTween (targs: Object,
 props: Object): Void
Remove specific or all tweening properties from specific or all tweening targets in engine.

Usage:
// stop any tweens running in clip0
ZigoEngine.removeTween(clip0);
 
ZigoEngine.doTween(clip1, "_x, _xscale, _alpha", ["100", 200, 0], 1, "easeInOutExpo");
// during tween, kill off just the slide and scale but allow the fade-out to run:
ZigoEngine.removeTween(clip1, "_x, _scale");
 
// kill all tweens in multiple targets
ZigoEngine.removeTween([clip2,clip3,clip4]);
The onTweenInterrupt event is fired by the engine when this method is used (see addListener for more info).

Parameters:
targs
a single target object, array of targets, or FuseKitCommon.ALL for every active target
props
a property string, array of property strings, null or nothing for all props, FuseKitCommon.ALLCOLOR for any active color transform

resumeTween

public static function resumeTween (targs: Object,
 props: Object): Void
Unpause one or more tweens.

Usage:
ZigoEngine.resumeTween(clip1);
 
// resume all engine tweens in the swf
ZigoEngine.resumeTween(FuseKitCommon.ALL);

Parameters:
targs
a single target object, array of targets, or FuseKitCommon.ALL for every active target
props
a property string, array of property strings, null or nothing for all props, FuseKitCommon.ALLCOLOR for any active color transform

rewTween

public static function rewTween (targs: Object,
 props: Object,
 pauseFlag: Boolean,
 suppressStartEvents: Boolean): Void
Rewinds and either pauses or restarts one or more tweens

Usage:
ZigoEngine.doTween(clip1, "_x, _xscale, _alpha", ["100", 200, 0], 1, "easeInOutExpo");
// during tween, rewind just the slide and scale but allow the fade-out to run:
ZigoEngine.rewTween(clip1, "_x, _scale");
 
// rewind and pause all tweens in several targets
ZigoEngine.rewTween([clip2,clip3,clip4], null, true);
 
// You may not want start callbacks and/or events to re-fire on rewind.
// These can be suppressed using the 4th parameter as in this example.
var listenerObj:Object = new Object();
listenerObj.onTweenStart = function(o:Object):Void {
	trace(o.target+" start Event, props started: "+o.props);
};
ZigoEngine.initialize(clip5); // prepares clip to add a listener
clip5.addListener(listenerObj);
ZigoEngine.doTween(clip5, "_x", "100", 3, "easeInOutBack", 0,
						{startfunc:function(){trace("Start Callback!");}});
function onMouseDown() {
	// click the stage to restart the animation before it ends.
	// the events are not refired.
	ZigoEngine.rewTween(clip5, null, false, true);
}

Parameters:
targs
a single target object, array of targets, or FuseKitCommon.ALL for every active target
props
a property string, array of property strings, null or nothing for all props, FuseKitCommon.ALLCOLOR for any active color transform
pauseFlag
true to rewind-and-pause
suppressStartEvents
if true is not passed, engine will refire 'onTweenStart' event and any start callbacks associated with the tween

setColorByKey

public static function setColorByKey (targetObj: Object,
 type: String,
 amt: Number,
 rgb: Object): Void
(General) Color-transforms a target by keyword.

Example: ZigoEngine.setColorByKey(my_mc, 'tint', 50, 0x33FF00);

Parameters:
targetObj
MovieClip or target to alter
type
String "brightness", "brightOffset", "contrast", "invertColor", or "tint"
amt
Percentage, can be negative in some cases
rgb
For "tint", a color value in 0x000000 or "#000000" format

setControllerDepth

public static function setControllerDepth (depth: Number): Void
Creates a clip in the _root timeline called "ZigoEnginePulse" or sets its depth

Parameters:
depth
If null or nothing passed the beacon clip is placed at depth 6789, but a depth of 0 will be more convenient if you'll be using depth management in _root.

setUpdateInterval

public static function setUpdateInterval (time: Number): Void
When set, the engine will run on a setInterval pulse instead of a frame pulse.

In most cases it is best to leave the engine in its default state since a frame-based pulse usually renders more smoothly. The engine always uses seconds for tween duration so using a longer interval will only reduce animation quality, not slow tweens down. This may be desirable in some cases, for instance to reduce CPU usage in banners.

Parameters:
time
Pulse duration in milliseconds, or null/undefined to return to an frame-based pulse.

simpleSetup

public static function simpleSetup (shortcutsClass: Function): Void
An alternative setup command that extends prototypes with shortcuts like alphaTo.

This setup command should only be called once at the beginning of your program. Use either this or register, not both. The difference is that simpleSetup alters base prototypes so that you may call tween methods directly on targets, such as my_mc.alphaTo(0);.

Example:
import com.mosesSupposes.fuse.*;
ZigoEngine.simpleSetup(Shortcuts,PennerEasing);
Note that to keep filesize to a minimum you should only register the features you intend to use. Use publish settings to "omit trace actions" to further reduce filesize.

Parameters:
shortcutsClass
It is madadory to pass the Shortcuts class during this call! You may additionally pass any of the following classes (all are optional), as in the way PennerEasing is added above.
  • PennerEasing Enables shortcut strings like "easeOutQuad" to be used with the engine. See PennerEasing
  • Fuse Enables Fuse for animation sequencing. Note that if animation won't be sequenced you do may simply import and use Fuse without ZigoEngine. See Fuse
  • FuseFMP Enables shortcut strings like DropShadow_distance to be tweened in the engine. See FuseFMP
  • FuseItem Enables Fuse-style Object Syntax to be used with the ZigoEngine.doTween. Note that Fuse does not need to be registered to use this feature. See FuseItem
  • skipTweenTo

    public static function skipTweenTo (seconds: Number,
     targs: Object,
     props: Object): Void
    Jumps a tween to a specific point in its duration.

    Results vary dramatically based on the easing style used.

    Usage:
    // jump to halfway through a 2-second tween
    ZigoEngine.skipTweenTo(1, clip1);

    Parameters:
    seconds
    amount of time within the tween duration to jump to (for instance, in a 1.5-second tween, .75 jumps to the halfway point).
    targs
    a single target object, array of targets, or FuseKitCommon.ALL for every active target
    props
    a property string, array of property strings, null or nothing for all props, FuseKitCommon.ALLCOLOR for any active color transform

    unpauseTween

    public static function unpauseTween (targs: Object,
     props: Object): Void
    Legacy - see resumeTween


    The documentation was generated from the following file:


    Generated on 1/14/2007 11:31:53 PM