Page Principale | Package | Index | Aide

com.mosesSupposes.fuse

class ZigoEngine

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


class ZigoEngine
extends Object

Un moteur robuste et central de calcul pour tout tweens codés d'un swf publié en AS2.

Utilisation:
Vous pouvez mettre en place votre projet, afin qu'il utilise le moteur ZigoEngine, de ces différentes façons:
  • importez tout simplement cette classe et commencez à utiliser ses méthodes statiques telles que doTween.
    - Vous avez la possibilité d'en augmenter les capacités en utilisant register.
  • Ou bien utilisez simpleSetup pour ajouter des raccourcis de tweens tels-que alphaTo aux MovieClips, Boutons et TextFields.

Étendre les prototypes est entièrement optionnel dans cette version - toute fonctionnalité de raccourci est retirée du coeur de la classe moteur.

Évènements dispatchés par ZigoEngine (cf addListener pour plus d'infos):
  • onTweenAdd
  • onTweenInterrupt
Évènements dispatchés individuellement par les objets cibles (cf ZManager pour plus d'infos):
  • onTweenStart
  • onTweenUpdate
  • onTweenEnd


Auteur:
Moses Gunesch / MosesSupposes.com / ZigoEngine basé sur les concepts de Ladislav Zigo, Zeh Fernando

Version:
2.1


Sommaire des champs

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.

Sommaire de Méthode

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
Génère et lance immédiatement une ou plusieurs interpolations de propriété sur une ou plusieurs cibles.

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
Une commande de setup optionnelle qui déclare des classes additionnelles à utiliser avec le moteur 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.

Utilisation:
// 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).

Utilisation:
// 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.

Utilisation:
ZigoEngine.OUTPUT_LEVEL = 2;
            
            
<ul>
            <li>0 = no traces,</li> 
            <li>& 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.

Utilisation:
// 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.

Utilisation:
// 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.

Utilisation:
// 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.

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


Documentation de Méthode

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.

Utilisation:
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();
}
  

Paramètres:
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.

Paramètres:
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.

Paramètres:
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.
Retourne:
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
Génère et lance immédiatement une ou plusieurs interpolations de propriété sur une ou plusieurs cibles.

ZigoEngine.doTween(my_mc, '_x,_y', [100,150], 1, Strong.easeInOut); 
La syntaxe objet à la Fuse peut aussi être utilisée si la classe FuseItem est déclarée (avec register):
ZigoEngine.doTween({ target:my_mc, start_alpha:0, y:150, ease:Strong.easeInOut });

Paramètres:
targets
Un objet cible ou un tableau d'objet à interpoler.
(Toutes les propriétés listées dans le paramètre suivant seront interpolées dans toutes les cibles spécifiées.)
props
Chaînes de caractères comme"_x", liste de propriétés séparées par des virgules "_x,_y", ou en tableau comme ["_x","_y"].
Le moteur accepte n'importe quelle propriété existante dans la cible même une variable que vous auriez customisé, ainsi que les propriétés spéciales suivantes:
  • _bezier_ Object {x:,y:,controlX:,controlY:} génère un déplacement en courbe de bezier.
    • Les valeurs relatives (chaîne) sont possibles pour tous les paramètres
    • Seulement deux propriétés sont nécessaires pour interpoler une courbe
    • Exemple, déplacement sur la droite en arc de cercle vers le haut:
      ZigoEngine.doTween(clip1, "_bezier_", {x:"100",controlY:"-50"});
  • _brightness -100=noir, 0=normal, 100=blanc
  • _brightOffset effet densité des couleurs (Burn). -100=noir, 0=normal, 100=blanc
  • _colorReset 100 = restaure entièrement les couleurs de la cible.
  • _colorTransform objet générique dans dans le format de "transform" de Flash7: {ra:,rb:,etc.}
  • _contrast 0=gris, 100=normal, 200=fort-contraste, plus=posterizé
  • _fade comme _alpha + _visible. Généralement utilisé avec des valeurs 0 ou 100 .
    • La visibilité est coupée quand les tweens finissent avec des valeurs inférieures à 50
    • La visibilité est enclenchée quand un tween _fade démarre
  • _frame Tween la timeline d'un MovieClip cible vers une frame de cette timeline.
  • _invertColor 100 = effet de négatif Photo.
  • _scale met _xscale et _yscale à la même valeur.
  • _size met _width et _heightà la même valeur.
  • _tint Accepte différents formats:
    • 0x000000 et "#000000" hex formats
    • null (reinitialise à la couleur d'origine)
    • Objet avec teinte (tint) & pourcentage:
      {tint:Number/null/hexString, percent:Number/String}.
  • _tintPercent Valeur entre 0 et 100
Quand FuseFMP est déclarée, un grand nombre de propriétés de BitmapFilter sont tweenables:
  • Blur_blurX, etc. le format suit la convention suivante nomDuFiltre+"_"+ propriété.
endvals
valeur de fin d'un tween ou, le cas échéant, un tableau de valeurs de fins correspondantes. Une seule valeur de fin peut très bien être utilisée avec de multiples propriétés.
Plusieurs formats possibles:
  • Number Une valeur de fin normale, absolue. Tweener _x de 10 dans la timeline principale bouge de 10px depuis le bord gauche du la scène (Stage).
  • Chaîne (String) - Valeurs relatives: Passer un nombre sous forme de chaîne du genre "10" or "-10" calculera la valeur de fin relativement à la position de départ du tween.
    Exemples: Tweener _x to "10" bouge un clip de 10px vers la droite de sa position.
    Tweener _rotation a une valeur chaîne negative comme "-90" fait une rotation dans le sens inverse des aiguilles d'une montre.
  • Bezier, tint, ou objet color-transform cf les propriétés _bezier_, _colorTransform, _tint plus haut.
  • Objet Multi-valeurs ou tableau (Array) - (Niveau avancé) Une nouvelle fonctionalité qui permet de tweener directement des valeurs multiples dans un Objet ou un tableau. Notez que comme toute variable personnalisée, ces objets doivent exister et avoir des valeurs numériques avant d'être tweenés.
    var myObj:Object = {x:0,y:0,z:0}; ZigoEngine.doTween(this, "myObj", { x:1, y:2, z:3 });

    Notez aussi que puisque ce paramètre accepte déjà un tableau pour d'éventuelles valeurs de fins multiples, vous devez l'inclure dans un second tableau:
    var myArray:Array = [ 0, 0 ]; ZigoEngine.doTween(this, "myArray", [[10,20]]);
  • Tableau de couleurs - (Niveau avancé) Tweener un tableau de valeurs de couleurs peut s'avérer utile dans des situations comme de tweener les propriétés d'un dégradé qui sera re-dessiné à chaque rafraîchissement du tween. Tout tableau ayant un nom contenant 'colors' (peu importe la casse) sera géré par le moteur comme un tableau de valeurs de couleurs. Notez qu'en interne les colortransforms ne sont appliqué à aucune cible, juste mis à jour dans le tableau.
    Exemple: ZigoEngine.doTween(this, "myColors", [[ 0x000000, 0xFFFFFF ]], 1, null, 0, { scope:this, updfunc:'redrawGradient' });

(Niveau avancé) Exemple de tween d'objet Matrice pour bouger et distordre un clip (à partir de Flash 8 uniquement):
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
Durée de tween. Si aucune valeur n'est passée la valeur par défaut vaudra celle de ZigoEngine.DURATION.
ease
Accept un nombre de format selon les fonctionalités déclarés (passé à la fonction statique register) :
  • fonction - comme mx.transitions.easing.Strong.easeInOut
  • Chaîne -raccourci- "easeInOutQuint" Ou n'importe quel nom de fonction de PennerEasing
  • Tableau généré par le Custom Easing Tool. (Ce panneau spécial est installé dans Flash quand vous installez le kit Fuse v2.1 ou la dernière extension MXP). Notez que la classeCustomEasing doit être déclarée pour utiliser cette fonctionnalité
  • null ou rien - donne par défaut la valeur de ZigoEngine.EASING si affectée, ou PennerEasing.easeOutQuint, qui est codée en dur dans le moteur comme fonction par défaut.
delay
les secondes à attendre avant de démarrer le tween La Start callback ainsi que l'évènement onTweenStartsont déclenchés à la fin du délai.
callback
fonction, chaîne, ou objet

Le kit essaye d'analyser les callbacks sous plusieurs formats. Notez que pour que les callbacks s'exécutent correctement il est crucial que la portée "this", dans laquelle sera localisé et déclenché la fonction, soit défini. Bien que le moteur souvent localisera avec succès vos callbacks l'option recommandée est l'Objet Callback , qui est le plus stable, demande le moins d'analyse (parsing) et vous permet de définir clairement la portée tout en apportant quelques option de tween supplémentaires.
  1. Function
    ZigoEngine.doTween(mc,"_x",100,1,"linear",0, myCallback);
    • Référence: myCallback
    • String: "myCallback"
    • Inline: function(){ ... }
    • Delegate: mx.utils.Delegate.create(....) - rajoute de la portée
  2. Easyfunc String (les Shortcuts doivent être déclarés pour utiliser cette fonctionnalité)
    ZigoEngine.doTween(mc,"_x",100,1,"linear",0, "this.myCallback(true);");
    • exemple: "trace('Le tween est fini');"
    • Permet des portées complexes et de multiples types de données en paramètre :
      "myscope.myscope.myfunc(true,1,'hello',{paramA:1,paramB:false,[0,1],null);"
    • Il vous est également possible d'utiliser des chaînes easyfunc dans des objets callbacks (voir plus bas) pour les callbacks de start, d'update et de end.
    • Limitations: Les chaînes Easyfunc ne sont pas une bonne option dans le codage en classes. Elles fonctionnent très bien dans la timeline de _root, elles renforcent le paradigme des Shortcuts. Quand une callback réside dans une frame d'une timeline de sous-clip, la chaîne easyfunc devrait contenir le chemin absolue vers une fonction. Par exemple si clip1 existe dans la timeline _root et contient la fonction myCallback, utilisez "clip1.myCallback();".

      Une façon pas vraiment pratique de contourner le problème pour les codeurs en classes est de d'affecter une référence locale comme. var t:MyClass=this; précédant une easyfunc comme "t.myMethod();", qui exploite la chaîne de portée durant l' éval. Encore une fois, les objets Callbacks sont conseillés aux codeur OO.
  3. Objets de Callback 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 Fonction, nom de fonction sous forme de chaîne, ou une chaîne Easyfunc comme "myClip.doSomething(true);" (les Shortcuts doivent être déclarés pour utiliser Easyfunc.)
    • scope L'objet "this" dans lequel localiser et déclencher la callback. Pas requis à tous les coups mais recommandé si le moteur n'arrive pas à localiser la callback ou s'il déclenche une mauvaise fonction.
    • args Un argument o un tableau d'arguments à passer à la callback func.
    • startfunc Callback déclenchée après tout délai et au moment ou le tween démarre. Supporte différents formats (cf func plus haut).
    • startscope Portée spécifique pour la callback startfunc. Si non définie, la propriété scope sera utilisée.
    • startargs Un argument o un tableau d'arguments à passer à la callback startfunc.
    • updfunc Callback déclenchée par le moteur à mesure que les tweens dans l'action sont mis à jour. Supporte différents formats (cf func plus haut).
    • updscope Portée spécifique pour la callback updfunc. Si non définie, la propriété scope sera utilisée.
    • updargs Un argument o un ableau d'arguments à passer à la callback updfunc.

    Parametres additionels d'objets callback
    • cycles Tweens en aller et retour entre le début et la fin.
      0 or "LOOP" = infinite cycles, default = 1, 2 or more to specify cycles.
    • skipLevel 0,1, ou 2.Un réglage de comportement "avancé" dans les cas d'échec des tweens . Cf SKIP_LEVELpour plus de détails.
      Inclure ce paramètre dans un objet de callback redéfinit la valeur par défaut suivant chaque tween.
    • Un cinquième paramètre extra1 envoyé à la méthode d'easing. Amplitude d'interpolation Élastique (Elastic) ou taux de dépassement pour la méthode Back.
    • Un sixième paramètre extra1 envoyé à la méthode d'easing. Période d'élasticité de la méthode d'easing "Elastic".
    • roundResults Redéfinit la valeur de classe par défaut ROUND_RESULTS individuellement pour chaque tween. Très utile par exemple, si la valeur par défaut de la classe est true mais que vous souhaitiez exécuter un tween comme DropShadow_alpha qui nécessite un intervalle de 0 à 1.
    • easyfunc Supprimé du kit. Les paramètres func, startfunc, updfunc acceptent maintenant des chaînes easyfunc (cf func plus haut).
Retourne:
Une chaîne formatée:
Le moteur fait le rapport de quelle propriété a été ajoutée à sa liste de tweens actifs en retournant une chaîne séparée par des virgules de seules propriétés qui ont été ajoutées avec succès, exemple "_x" ou "_x,_y". Cela peut différer légèrement de ce qui a été tweené, comme pour "_width,_height" quand "_size" fut tweené.

Si plusieurs cibles sont passées au moteur, une série de propriétés sont retournées dans l'ordre des cibles, ce qui permet une analyse granulaire des propriétés pour chaque cible.
var results:String = ZigoEngine.doTween([clip1,clip2,clip3],"_scale",100,null,0,{skipLevel:1});
// results: "_xscale,_yscale||_xscale,_yscale"
// parce que l'échelle du clip2 était déjà fixée à 100 et que le skipLevel est réglé sur 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.

Utilisation:
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]);

Paramètres:
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.

Paramètres:
targOrTransObj
target object or Flash7-style color-transform object with props like ra, etc.
Retourne:
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.

Paramètres:
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.

Retourne:
numeric depth in _root

getTweens

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

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

getUpdateInterval

public static function getUpdateInterval (): Number
Retourne:
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.

Paramètres:
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.

Paramètres:
targ
a single target object to test
prop
a specific property string
Retourne:
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.

Paramètres:
targ
Object to lock
Retourne:
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

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

Paramètres:
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
Retourne:
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.

Utilisation:
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);
}

Paramètres:
targ
Object to lock
setLocked
locked value
See also:

pauseTween

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

Utilisation:
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);

Paramètres:
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
Une commande de setup optionnelle qui déclare des classes additionnelles à utiliser avec le moteur ZigoEngine.

Cette commande ne devrait être appelle qu'un fois au début de votre programme. Utilisez soit cette commande soit simpleSetup, pas les deux. La différence est que register relie les classe additionnelles sans altérer les prototypes.
import com.mosesSupposes.fuse.*;
ZigoEngine.register(PennerEasing, Fuse, FuseFMP); 
Notez que pour garder un poids de fichier le plus petit possible vous ne devriez déclarer que les fonctionnalités (classes) dont vous vous servez. Cochez également "omit trace actions" dans les paramètres de publications pour réduire aussi le poids.

Paramètres:
classReference
Passez n'importe laquelle de ces classes (toutes sont optionnelles):
  • Shortcuts enclenche doShortcut, le parsing des callbacks d'easyfunc' , ainsi que l'option de copier / supprimer manuellement des shortcuts dans n'importe quelle cible ou prototype en utilisant initialize. Cf Shortcuts
  • PennerEasing Permet d'utiliser avec le moteur des chaîne de caractères raccourcies telles que "easeOutQuad". Cf PennerEasing
  • Fuse enclenche Fuse pour des animations séquentielles. Notez que si votre animation n'a pas de tweens vous pouvez tout simplement importer et utiliser Fuse sans le moteur ZigoEngine. Cf Fuse
  • FuseFMP enclenche des raccourcis comme DropShadow_distance a tweener dans le moteur. Cf FuseFMP
  • FuseItem enclenche le style de syntaxe Objet de Fusepour être utilisé avec ZigoEngine.doTween. Notez qu'il n'est as necessaire de déclarer Fuse pour utiliser cette fonctionalité. Cf FuseItem

removeListener

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

Paramètres:
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.

Utilisation:
// 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).

Paramètres:
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.

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

Paramètres:
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

Utilisation:
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);
}

Paramètres:
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);

Paramètres:
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

Paramètres:
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.

Paramètres:
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.

Paramètres:
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.

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

    Paramètres:
    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:


    Générée le 1/14/2007 11:31:53 PM