Main Page | Package | Index | Help

com.mosesSupposes.fuse

class ZigoEngine

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


class ZigoEngine
extends Object

AS2 でパブリッシュされた swf 用の、スクリプトトゥイーンの処理エンジンです。

Usage:
ZigoEngine をあなたのプロジェクトで使いたい場合、以下の方法で使えるようになります:
  • 単純にクラスをインポートして、doTween のような static なメソッドを使う方法。
    - register を使ってオプションでエンジンを拡張させることもできます。
  • または simpleSetup を使って、ムービークリップ・ボタン・テキストフィールドに対して alphaTo のようなトゥイーニングショートカットを追加する方法。.

このバージョンでは、プロトタイプ拡張はオプション扱いとなっています - ショートカット機能は全て、コアエンジンクラスから除外されました。

ZigoEngine から配信されるイベン(詳細は addListener をご覧ください):
  • onTweenAdd
  • onTweenInterrupt
各ターゲットオブジェクトから配信されるイベント(詳細は ZManager をご覧ください):
  • 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) 新規トゥイーンが追加された際に、ターゲットのトゥイーンプロパティを停止するかどうかを選べます。.

DURATION

public static var DURATION: Number = 1
個別に設定されていない場合の、デフォルトのトゥイーン時間です。

Usage:
// エンジンのデフォルト設定を変えるのであれば、プログラムの先頭で1度だけ設定すればOKです。
ZigoEngine.DURATION = .5;

EASING

public static var EASING: Object = "easeOutQuint"
個別に設定されていない場合の、デフォルトのイージング方式です。

デフォルトのトゥイーンだけは、エンジン中にハードコードされていますので、わざわざ PennerEasing を登録する必要はありません。しかし "easeOutQuad"のようなストリングをプロパティに指定したい場合は、そのクラスを register しなければいけません。また、標準のイージング関数(mx.transitions.easing)についても、同様にインポートしておく必要があります。

Usage:
// PennerEasing を使った例
ZigoEngine.register(PennerEasing);
ZigoEngine.EASING = 'easeInOutExpo';
 
// あるいは、代わりに mx スタイルのトゥイーンを使用した例
import mx.transitions.easing.Elastic;
ZigoEngine.EASING = Elastic.easeOut;

OUTPUT_LEVEL

public static var OUTPUT_LEVEL: Number = 1
エンジンから出力されるフィードバックの情報量をコントロールできるので、デバッグに役立ちます。

Usage:
            ZigoEngine.OUTPUT_LEVEL = 2;
            
            <ul>
            <li>0 = 出力なし</li> 
            <li>1 = 通常のエラーと警告</li>
            <li>2 = 詳細情報も出力</li>
            </ul> 

ROUND_RESULTS

public static var ROUND_RESULTS: Boolean = false
true に設定すれば、エンジンが数値を自動的に丸めて(整数にして)くれます。ピクセルフォントの使用に役立ちます。

この機能を利用すると、アニメーションの精度やパフォーマンスが低下します。数値を丸める必要があるプロジェクトにのみ、true 設定して使うようにして下さい。

Usage:
// プログラムの先頭で1度設定しておけば、以降は、エンジンのデフォルト設定として変更されます。
ZigoEngine.ROUND_RESULTS = true;

SKIP_LEVEL

public static var SKIP_LEVEL: Number = 0
(Advanced) トゥイーンしても見かけ上の変化がなかったり、0秒でのドゥイーンといった状況下での、エンジンのデフォルトのふるまいを設定できます。

Usage:
// プログラムの先頭で1度設定しておけば、以降のデフォルト設定となります。
ZigoEngine.SKIP_LEVEL = 2;
時間無しトゥイーン(0秒トゥイーン)
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.

変化無しトゥイーン
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= デフォルトの設定。
    変化なしトゥイーンでも、各自の継続時間設定(duration と delay)通り動き、コールバックとイベントも実行されます。 No-duration tweens set the property and execute all callbacks and events immediately or after a delay.
  • 1= 変化無しトゥイーンをスキップします。
    見かけ上変化のないトゥイーンは破棄されます(dilay も duration 設定も無視されます)。コールバックとイベントは即座に実行されます。No-duration tweens ignore delay and set properties immediately.
  • 2= 変化無しトゥイーンや0秒トゥイーンの場合は、イベントもコールバックも実行しないようにします。
    変化無しトゥイーンは完全に無視されます(何も起こりません)。0秒トゥイーンは 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
デバッグ機能:全てのトゥイーンの実行速度を一括で調整(スキップ、スピードアップ、スロー)することができます。ZigoEngine と Fuse の全ての設定値が、この値を乗算します。

全ての再生時間(duration)、遅延時間(delay)、キット中の時間ベースのトリガー機能に影響します。

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

全てのアニメーションの再生時間を0にしたり、早めたりできます。. Fuse.fastForward とは違って、トゥイーンに関連づけられた全てのコールバックとイベントは実行されます。ただ単に、duration が 0 になるということです。それでも SKIP_LEVEL 設定を使えば、その振る舞いをも変更することは可能です。

0から1の間の値にすれば、各トゥイーンン設定された再生時間より速くなります。パーセンテージで考えると理解しやすいでしょう。例えば .25 と設定すれば、再生時間は 25% になるので、各トゥイーンに設定された実際の再生時間設定よりも速くなります。

1以上に設定すると、今度は値を増やせば増やすほど、スローになっていきます。これもパーセンテージで考えるとよいでしょう。例えば、値を 2 にすると、再生時間は倍遅くなります。

Usage:
// プログラムの先頭で1度設定しておけば、以降のデフォルト設定となります。
ZigoEngine.TIME_MULTIPLIER = .5; // 全トゥイーンを倍速で実行させます。

(advanced) さらに複雑な Fuse シーケンスのデバッグ方法として、シーケンス中でこのプロパティを切り替えつつ使用することもできます。下の例をご覧ください。
var testMode:Boolean = true;
function setTimeMultiplier(mult:Number):Void {
	if (testMode==true) ZigoEngine.TIME_MULTIPLIER = mult;
}
var f:Fuse = new Fuse();
f.scope = this;
// シーケンス中の全トゥイーンをスキップ再生します。
f.push({ func:setTimeMultiplier, args:0 });
// 以降のシーケンスは通常のスピードで再生させます。
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"
ランタイム時やデコンパイル時に、キットのバージョンを取得することができます。

Usage:
trace(ZigoEngine.VERSION); // バージョンが正しく表示されない時は、ASO ファイルのキャッシュをクリアして下さい。


Method Documentation

addListener

public static function addListener (handler: Object): Void
(Advanced) "onTweenAdd" や "onTweenInterrupt" イベントに、リスナーを追加する時にこのメソッドを使います。イベントはエンジンから直接ブロードキャストされます。

Usage:
これらのイベントは ZigoEngine クラスが直接配信する形をとる特殊なイベントです。その点で、 onTweenEnd (詳細は ZManager をご覧ください)のようなターゲットイベント形式とは異なります。

"onTweenAdd" イベントは doTween が呼び出された際に実行されます。, and passes the final parameters that will be sent to 内部の ZManager インスタンスに対し、次の順番で送られます:
  • トゥイーンターゲットを格納した配列
  • ZManager.paramsObj メソッドで生成されたプロパティ文字列を格納した配列。
    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 valid easing function
  • トゥイーン待機時間(秒)
  • 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) ターゲットをエンジン使用対象からクリアします。

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
doTween の代替で、ショートカットシンタックスが使えます。Shortcuts クラスが登録されている必要があります。

このアイデアは Yotam Laufer さんによるものです。例:
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
単一あるいは複数ターゲットの、単一あるいは複数プロパティに対し、トゥイーンを設定&実行できます。

ZigoEngine.doTween(my_mc, '_x,_y', [100,150], 1, Strong.easeInOut);
FuseItem クラスが登録されていれば、 Fuse スタイルのオブジェクトシンタックスも使えるようになります:
ZigoEngine.doTween({ target:my_mc, start_alpha:0, y:150, ease:Strong.easeInOut });

Parameters:
targets
トゥイーン対象となるターゲットオブジェクト、または複数ターゲットを格納した配列
全てのターゲットにおいて、以下にリストアップする全てのプロパティがトゥイーン可能です。 )
props
"_x" のような文字列や、"_x,_y" のようにカンマで区切ったもの、["_x","_y"]のようなプロパティの配列が使えます。.
エンジンではターゲットが持つ全プロパティ(自分で定義した変数も含む)を指定でき、また以下のスペシャルプロパティも使用できます:
  • _bezier_ オブジェクト {x:,y:,controlX:,controlY:} でカーブ状のモーションパスが使えます。
    • 全パラメーターにおいて、相対(文字列)値が使用できます
    • カーブ状にトゥイーンさせるには最低2つのプロパティ指定が必要です
    • 例えば、上方向にカーブを描きつつ、右移動させるには:
      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.
    • 設定値が50以下の時は、トゥイーン終了後、自動的に _visible = false になります
    • 設定値が何であれ、 _fade が開始されたタイミングで、自動的に _visible = true になります
  • _frame ターゲットのムービークリップのタイムラインを、指定のフレームまでイージングをかけつつトゥイーンさせることができます
  • _invertColor 100 = 写真のネガ効果
  • _scale _xscale_yscale を同じ値にします。
  • _size _width_height を同じ値にします。
  • _tint いくつかの指定方法があります:
    • 0x000000"#000000" のような16進数
    • null (カラーを全てリセット)
    • 着色とパーセンテージプロパティからなるオブジェクト:
      {tint:Number/null/hexString, percent:Number/String}.
  • _tintPercent 0-100の値をとります
FuseFMP が登録されている場合、膨大な種類の BitmapFilter プロパティもトゥイーン可能になります:
  • Blur_blurX, etc. 「フィルタ名の短縮形 +"_"+ フィルタプロパティ」の命名規則が使われています。
endvals
トゥイーンの目標(終了)値、または複数の目標値の配列。複数のプロパティに対して、目標値1つで対応させることも可能です。
いろんなフォーマットに対応しています:
  • Number 絶対値指定。最も一般的な目標値指定。 _x に対し、目標値 10 指定でトゥイーンさせるとステージの端から 10px の所に移動します。
  • String - Relative values: 文字列による相対値指定。Passing a string version of a number like "10" や "-10" といった文字列(" "で囲まれているので文字列扱いになる)を指定すると、トゥイーン開始位置からの相対位置で移動します。
    例: _x を "10" 指定でトゥイーンさせると、そのクリップがいた場所からみて 10px 右の地点に移動します。
    Tweening _rotation to a negative string value like "-90" affects a counter-clockwise spin.
  • Bezier, tint, or color-transform object については、前述の _bezier_, _colorTransform, _tint をご覧下さい。
  • Multi-value Object or Array - (Advanced) 新機能として、オブジェクトや配列中の複数の値をトゥイーンさせることができるようになりました。カスタム変数をトゥイーンさせたい場合は、その変数が、トゥイーン以前にきちんと定義されているか、かつ、その変数は数値であることが必要がありますのでご注意ください。
    var myObj:Object = {x:0,y:0,z:0}; ZigoEngine.doTween(this, "myObj", { x:1, y:2, z:3 });

    複数の目標値を配列としてパラメーター指定した際は、次の配列はきちんとラップしておくようにしてください:
    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)次の例は、Matrix オブジェクトをトゥイーンさせることで、クリップを移動&傾き変形(せんだん?)させる例です。(要 Flash8):
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
トゥイーンさせる時間です。指定しない場合は、デフォルト値である ZigoEngine.DURATION の値になります。
ease
登録する機能次第で、いろんなフォーマット指定が使えます:
  • function - mx.transitions.easing.Strong.easeInOutなど
  • ショートカット文字列 - "easeInOutQuint"のような PennerEasing 由来の関数の文字列
  • Custom Easing Tool で生成した配列( Fuse Kit v2.1 以降の MXP エクステンションをインストールしていれば、カスタムイージング生成パネルがFlashにインストールされます)。この機能を使うには CustomEasing クラスを登録しておく必要があります。
  • null や指定しない場合 - ZigoEngine.EASING を設定している場合は、それがデフォルト設定となり、設定していない場合は、エンジンに事前にハードコード(埋め込まれている)されている、PennerEasing.easeOutQuint がデフォルトとの振る舞いとして設定されます。
delay
トゥイーンを開始するまでの待機時間。 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
トゥイーンを終点まで早送りし、そのトゥイーンをエンジンから削除します。

Usage:
ZigoEngine.doTween(clip1, "_x, _xscale, _alpha", ["100", 200, 0], 1, "easeInOutExpo");
// トゥイーン中、スライド移動と、スケールの拡大を早送り、フェードアウトだけはそのまま実行:
ZigoEngine.ffTween(clip1, "_x, _scale");
 
// 複数ターゲットの全てのトゥイーンを早送り
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
ターゲットオブジェクト中でアクティブなトゥイーンの数を返してくれます。

Parameters:
targ
target tween passed to determine if active, or FuseKitCommon.ALL を指定すると全てのターゲットが対象になります。
Returns:
一時停止中または再生中のアクティブなトゥイーン数。

getUpdateInterval

public static function getUpdateInterval (): Number
Returns:
setUpdateIntervalで使用している数値。未指定時は undefined が返されます。

See also:

initialize

public static function initialize (target: Object): Void
(Advanced) ターゲットがエンジンを使える状態にします。

simpleSetup を使ってプロトタイプ拡張をした場合は、このメソッドは必要ありません。It can be used to initialize specific targets to accept listeners prior to tweening - see ZManager for an example. Shortcuts クラスを 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
エンジンがトゥイーンを実行中、つまりパルスをアップデートしている場合に true を返します。

isTweening

public static function isTweening (targ: Object,
 prop: String): Boolean
ターゲットに対し、エンジンによって該当プロパティが関連づけられているかどうかを評価します。

Parameters:
targ
評価したい単数ターゲットオブジェクト
prop
プロパティの文字列
Returns:
一時停止中、再生中に関わらず、アクティブなトゥイーンが見つかった場合に true を返します。

isTweenLocked

public static function isTweenLocked (targ: Object): Boolean
トゥイーンがアンロックされるまでの間、トゥイーンをロックして再生を食い止めます。(isTweenLockdeは評価プロパティでは?)

Parameters:
targ
Object to lock
Returns:
locked value

isTweenPaused

public static function isTweenPaused (targ: Object,
 prop: String): Boolean
ターゲットオブジェクト中の特定のプロパティが一時停止されているかどうかを評価できます

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

Parameters:
targ
評価したい単数ターゲットオブジェクト
prop
プロパティ文字列。null や nothing とすると全プロパティを対象にできます。色の変更に関しては FuseKitCommon.ALLCOLOR を使用します。
Returns:
paused value

lockTween

public static function lockTween (targ: Object,
 setLocked: Boolean): Void
トゥイーンがアンロックされるまでの間、トゥイーンをロックして再生を食い止めます。

ロックされたターゲットに対してトゥイーンを呼び出そうとすると、警告メッセージが出力されます。

Usage:
一度に指定できるのは1ターゲットだけです。

エンジン中で現在トゥイーン実行中のターゲットにしか影響しないので、FuseKitCommon.ALL を指定することはできません。(実行中の全トゥイーンを停止、または一時停止したい場合は、 pauseTween(FuseKitCommon.ALL) を使うか、あるいは、 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
ロックしたいオブジェクト
setLocked
ロック値
See also:

pauseTween

public static function pauseTween (targs: Object,
 props: Object): Void
1個以上のトゥイーンを一時停止できます

Usage:
ZigoEngine.doTween(clip1, "_x, _xscale, _alpha", ["100", 200, 0], 1, "easeInOutExpo");
// トゥイーン実行中に、スライド移動と拡大だけを一時停止、フェードアウトは再生を続けます:
ZigoEngine.pauseTween(clip1, "_x, _scale");
 
// 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
ZigoEngine と併用して使いたい追加クラスを登録するコマンドのひとつです。

このセットアップコマンドはプログラム冒頭で1度呼び出しておけばOKです。この register か simpleSetup のどちらか一方を使うようにし、併用はしないで下さい。違いを挙げると、register はベースとなるプロトタイプを変更することなく、追加クラスにリンクさせる点です。
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
トゥイーンを再開します。

Usage:
ZigoEngine.resumeTween(clip1);
 
// 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
トゥイーンを巻き戻した後、そこで停止 or 再開させるかを選ぶことができます。

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
設定すれば、エンジンはフレーム周期ではなく、setInterval 周期で実行されるようになります。

ほとんどの場合、エンジンのデフォルト状態である、フレームベース周期のままにしておいた方が描画もスムーズで最善です。エンジンは常に秒ベースでトゥイーン時間で動くため、インターバルが長くなると、アニメーションのクオリティが下がってしまうのです。この機能は、バナー案件などで、CPU負荷を減らしたいような場合に使うことを想定しています。

Parameters:
time
ミリ秒単位で、周期時間を設定できます。 null/undefined 指定でフレームベース周期に戻せます。

simpleSetup

public static function simpleSetup (shortcutsClass: Function): Void
プロトタイプ拡張を実装するセットアップ方法のひとつで、alphaTo といったショートカットが使えるようになります。

このセットアップコマンドはプログラムの冒頭で1度呼び出せばOKです。このコマンドか register のどちらかを使うようにします。併用しないようにしてください。 相違点を挙げると、 simpleSetup はターゲット上で直接トゥイーンメソッドが呼び出せるように、ベースのプロトタイプを拡張する点にあります。例: my_mc.alphaTo(0);.

Example:
import com.mosesSupposes.fuse.*;
ZigoEngine.simpleSetup(Shortcuts,PennerEasing);
ファイルサイズを最小限に抑えるために、必要な機能だけを登録するようにしてください。さらに軽量化したい時は、パブリッシュ設定の「トレースを省略」を設定してください。

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 エンジン指定で "easeOutQuad" のようなショートカット文字列が使えるようになります。PennerEasing の項をご覧ください。
  • Fuse Fuse を使った連発アニメーションが使えるようになります。連続的に発動させる必要がない場合は、ZigoEngine は不要で、Fuse だけをインポートしてつかうようにしましょう。詳細は Fuse の項をご覧ください。
  • FuseFMP エンジン指定で DropShadow_distance をトゥイーンさせるといったショートカット文字列が使えるようになります。詳細は FuseFMP
  • FuseItem これを登録すれば、ZigoEngine.doTween にて、Fuseスタイルオブジェクトシンタックスが使えるようになります。この機能を使う場合は、別途 Fuse を登録する必要はありません。詳細は FuseItem
  • skipTweenTo

    public static function skipTweenTo (seconds: Number,
     targs: Object,
     props: Object): Void
    あるトゥイーンに対し、そのトゥイーンの指定秒数の状態までジャンプすることができます。

    イージングスタイルの設定によって、結果は大きく影響されます。

    Usage:
    // トゥイーン時間0.5秒の状態にジャンプします
    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