Main Page | Package | Index | Help

com.mosesSupposes.fuse

class Fuse

Array
  |
  +--com.mosesSupposes.fuse.Fuse


class Fuse
extends Array

イベントやアニメーションを順々に(連続的に)実行するためのシーケンサーです。Fuse クラスは Array クラスを拡張して作られています。

使い方:
アニメーションを連続再生させるには、ZigoEngine.registerZigoEngine.simpleSetup の引数に Fuse を指定して下さい。

利用可能なイベント
  • onStart
  • onStop
  • onPause
  • onResume
  • onAdvance
  • onComplete

AsBroadcaster ベースの ZigoEngine とは異なり、Fuse は mx EventDispatcher を使っています。
var f:Fuse = new Fuse();
f.addEventListener("onComplete", myListenerObj);

Fuse ユーテリティーは次の要素で構成されています:
  • クラス及びインスタンスのデフォルト設定
  • Array クラスのメソッド (see push)
  • 再生コントロール関連のメソッド (see start)
  • Simple Syntax static methods (see open)
  • A runtime Object Syntax interpreter (see Fuse)
  • インスタンス管理用のメソッド (see getInstance)

Fuse Object Syntax の引数については Fuse コンストラクタの部分に記載されています。

Fuse Simple Syntax の引数については Fuse.open の部分に記載されています。


Author:
Moses Gunesch / MosesSupposes.com

Version:
2.1


Field Summary

public static
AUTOCLEAR: Boolean = false
クラスのデフォルト設定:whether Fuse instances are automatically destroyed after playing once unless otherwise specified by instance-level autoClear.

public static
AUTOSTOP: Boolean = true
クラスのデフォルト設定:whether Fuse instances stop when a tween is interrupted, or is destroyed if autoClear is turned on, unless otherwise specified by instance-level autoStop.

public static
OUTPUT_LEVEL: Number = 1
クラスのデフォルト設定:Controls how much feedback Fuse outputs, helpful for debugging.

public static
VERSION: String = FuseKitCommon.VERSION
クラスのデフォルト設定:Enables kit version to be retrieved at runtime or when reviewing a decompiled swf.

Property Summary

public
autoClear: Boolean
インスタンスのデフォルト設定:Fuse instance is automatically destroyed after playing once.

public
autoStop: Boolean
インスタンスのデフォルト設定:Fuse instance stops when any of its running tweens are interrupted, or is destroyed if autoClear is turned on.

public
currentIndex: Number (read-only)
Retrieves the current play-index of a Fuse instance.

public
currentLabel: String (read-only)
Retrieves the currently playing action's label, if defined.

public
duration: Number
インスタンスのデフォルト設定:duration value in seconds for any action that does not specify one.
 
public
easing: Object
インスタンスのデフォルト設定:easing value for any action that does not specify one.

public
id: Number (read-only)
インスタンスのデフォルト設定:an auto-assigned numerical reference

public
label: String
インスタンスのデフォルト設定:Convenience, allows you to name any Fuse.

public
scope: Object
インスタンスのデフォルト設定:scope for all functions run from a Fuse if left unspecified within the action.

public
state: String (read-only)
Retrieves a Fuse instance's current play-state string.

public
target: Object (read, write)
インスタンスのデフォルト設定:Sets one or more animation targets that will be used for any actions that don't specify their own.

Constructor


Fuse ( action: Object)
Fuse extends Array to enable sequence-building & management using familiar methods like push().

Method Summary

public static
addCommand ( commandOrScope: Object, indexOrFunc: Object, argument: Object ): Void
シンプルシンタックス:Multi-purpose method to add an inline Fuse command, delay, or function-call to the open Fuse.

public
addEventListener ( event: String, handler: Object ): Void
Add a listener for a particular event

public
addTarget ( t: Object ): Void
Adds to current default target list.

public
clone ( ): Fuse
Returns a copy of Fuse as a new Fuse instance.

public static
close ( ): Void
シンプルシンタックス:Completes the Fuse generated by open.

public static
closeAndStart ( setStart: Object ): Void
シンプルシンタックス:Close the open Fuse instance and start it playing.

public static
closeGroup ( ): Void
シンプルシンタックス:Closes an action group started by openGroup.

public
destroy ( ): Void
Deletes all variables and properties in the Fuse instance.

public
fastForward ( resumeAtIndexOrLabel: Object ): Void
Fast-forwards animations in some or all remaining actions.

public
getActiveTargets ( includeDefaults: Boolean ): Array
Gets both the default target list and any targets in the action currently being played.

public static
getInstance ( idOrLabel: Object ): Fuse
Instance-management: Gets a Fuse instance by its id or label

public static
getInstances ( stateFilter: String, targets: Object ): Array
Instance-management: Get an array of some or all Fuse instances in active memory, with filtering options.

public static
open ( fuseOrID: Object ): Fuse
Simple Syntax:Generate a new Fuse and begin intercepting tween calls until close is called.

public static
openGroup ( fuseOrID: Object ): Fuse
シンプルシンタックス:Begins a new animation group of simultaneous actions.

public
pause ( ): Void
再生コントロール:Pauses a playing Fuse instance and its running tweens. Waits for resume call to proceed.

public
pop ( ): Object
Removes the first element from a Fuse and returns that action object.

public
push ( ): Number
Adds one or more elements to the end of a Fuse and returns the new length of the Fuse.

public
pushTween ( targets: Object, props: Object, endvals: Object, seconds: Number, ease: Object, delay: Number, callback: Object ): Number
Lets you add an item to the Fuse in ZigoEngine.doTween() syntax. Pushes tween arguments into Fuse instance and accepts the same arguments as ZigoEngine.doTween().

public
removeEventListener ( event: String, handler: Object ): Void
Remove a listener for a particular event

public
removeTarget ( t: Object ): Void
Removes targets from the current default target list.

public
resume ( ): Void
Resumes a paused Fuse instance and its animations. Attempts to correct for animations that have been disrupted during pause.

public
reverse ( ): Void
Reverse the sequence of the Fuse

public
setStartProps ( trueOrItemIDs: Object ): Void
General: Presets start-properties like start_x in all or specific items.

public
shift ( ): Object
Removes the first element from a Fuse and returns that action object.

public
skipTo ( indexOrLabel: Object ): Void
再生コントロール:Starts Fuse at a particular index/label.

public
slice ( indexA: Number, indexB: Number ): Array
Returns a new array instance consisting of a range of elements from the original array without modifying the original array. The array returned by this method includes the indexA element and all elements up to, but not including indexB element. If no parameters are passed, a duplicate of the original array is generated. For more information, see the Flash help explanation of Array.slice.

public
splice ( startIndex: Number, deleteCount: Number ): Void
Used to insert or remove items. Works almost exactly like Array.splice. Removed actions are destroyed permanently, with the exception of nested Fuses.

public
start ( setStart: Object ): Void
再生コントロール:Begins sequence play at index 0, with option to set start props prior to play.

public static
startRecent ( setStart: Object ): Void
シンプルシンタックス:Restarts the Fuse most recently created using Fuse.open().

public
stop ( ): Void
再生コントロール:Stops a playing or paused Fuse instance and resets the play-index to 0.

public
toString ( ): String


public
traceItems ( indexA: Number, indexB: Number ): Void
Traces specific or all objects contained within the fuse

public
unshift ( ): Number
Adds one or more elements to the beginning of a Fuse and returns the new length of the Fuse.



Field Documentation

autoClear

public var autoClear: Boolean
インスタンスのデフォルト設定:一度再生された Fuse インスタンスを自動的に削除します。

使い方:
var f:Fuse = new Fuse();
f.autoClear = true;
この例では、Fuse のインスタンス f は、一度再生された後、自動的に削除されます。同時に、 at which time you should also delete the variable f to prevent memory buffering issues.

AUTOCLEAR

public static var AUTOCLEAR: Boolean = false
クラスのデフォルト設定:一度再生された Fuse インスタンスを自動的に削除します。インスタンスレベルで個別に autoClear が設定されている時は、そちらが優先されます。

使い方:
// 一度設定するだけでよい
Fuse.AUTOCLEAR = true;
 
// 以降、インスタンス個別に上書き設定することも可能
var f:Fuse = new Fuse();
f.autoClear = false;
When a Fuse is set to auto-remove itself it is best practice to not set a variable reference to that Fuse, which may cause memory buffering, or to delete the variable when the Fuse is complete.

To override this default on a per-Fuse basis set the instance's autoClear property.

autoStop

public var autoStop: Boolean
インスタンスのデフォルト設定:実行中のトゥイーンが中断された時に、Fuse インスタンスを停止します。autoClear がオンになっている時は、インスタンスは削除されます。

使い方:
このインスタンスレベルでの設定はクラスデフォルト設定の Fuse.AUTOSTOP を上書きします。If false an interrupted Fuse will recover and continue to play through.
var f:Fuse = new Fuse();
f.autoStop = false; //この Fuse インスタンスのデフォルト設定を上書き

AUTOSTOP

public static var AUTOSTOP: Boolean = true
クラスのデフォルト設定:whether Fuse instances stop when a tween is interrupted, or is destroyed if autoClear is turned on, unless otherwise specified by instance-level autoStop.

使い方:
// once only
Fuse.AUTOSTOP = false;
If this default is set false, Fuses will skip past any externally interrupted tweens and continue to play through. When Fuses are used in interactive devices like rollover states, it is best to leave this setting true to avoid conflicts between Fuse instances controlling the same behavior.

Note that an interruption will not occur if new non-overlapping tweens are started on a clip that a Fuse is tweening. To enforce interruptions in such cases you can set ZigoEngine.com.mosesSupposes.ZigoEngine.AUTOSTOP to true, which causes all tweening properties in a clip to stop when a new tween is removed, or use ZigoEngine.com.mosesSupposes.ZigoEngine.removeTween prior to the call that may interrupt a Fuse.

To override this default on a per-Fuse basis set the instance's autoStop property.

duration

public var duration: Number
インスタンスのデフォルト設定:duration value in seconds for any action that does not specify one.

使い方:
This setting supercedes the default ZigoEngine.DURATION only for the Fuse instance it is set on, and is overrided by any action containing its own seconds, duration, or time parameter.
var f:Fuse = new Fuse();
f.duration = 2;
f.push({ x:'100' }); // adopts new default
f.push({ y:'100', time:.5 }); // overrides default

easing

public var easing: Object
インスタンスのデフォルト設定:easing value for any action that does not specify one.

使い方:
This setting supercedes the default ZigoEngine.EASING only for the Fuse instance it is set on, and is overrided by any action containing its own ease or easing parameter.
var f:Fuse = new Fuse();
f.easing = "easeInOutCubic";
f.push({ x:'100' }); // adopts new default
f.push({ y:'100', ease:'easeInExpo' }); // overrides default

label

public var label: String
インスタンスのデフォルト設定:Convenience, allows you to name any Fuse.

The Fuse label is used in output messages, and can be used to reference a Fuse instance in getInstance, fastForward and Simple Syntax methods open and openGroup.

使い方:
var drawContentPage:Fuse = new Fuse();
drawContentPage.label = "drawContentPage";

OUTPUT_LEVEL

public static var OUTPUT_LEVEL: Number = 1
クラスのデフォルト設定:Controls how much feedback Fuse outputs, helpful for debugging.

使い方:
// once only
Fuse.OUTPUT_LEVEL = 3;
  • 0 = no traces,
  • 1 = normal errors & warnings
  • 2 = additional Fuse output
  • 3 = additional FuseItem output

scope

public var scope: Object
インスタンスのデフォルト設定:scope for all functions run from a Fuse if left unspecified within the action.

使い方:
var f:Fuse = new Fuse();
f.scope = this;
f.push({target:menu, 
	start_alpha:0,
	x:getMenuX,
	y:getMenuY, 
	startfunc:"setupMenu", 
	updfunc:"onMenuFadeUpdate", 
	func:"onMenuShown"
});
f.push({ scope:contentArea,
	func:"drawContent"
});
In this example, all the functions in the first action, including the runtime-evaluation calls to supposed getMenuX and getMenuY methods will be auto-scoped to the Fuse's default scope (this). In the second action, drawContent is specifically scoped to the contentArea object, overriding the default. It's most useful to set a default scope when there will be many function calls within the sequence, to save you from specifically scoping each action.

VERSION

public static var VERSION: String = FuseKitCommon.VERSION
クラスのデフォルト設定:Enables kit version to be retrieved at runtime or when reviewing a decompiled swf.

使い方:
trace(Fuse.VERSION); // if the version is incorrect, clear your ASO cache.


Property Documentation

currentIndex

public currentIndex : Number (read-only)
Retrieves the current play-index of a Fuse instance.

Value:
A number starting at 0 for the first action

See also:

currentLabel

public currentLabel : String (read-only)
ラベル名が設定されている時、現在再生中のアクションのラベル名を探します。

{ label:"introFade", start_alpha:0, start_brightOffset:100, time:1.5, ease:"easeInExpo" }

Value:
A string set in the action object using the label property.

See also:

id

public id : Number (read-only)
インスタンスのデフォルト設定:an auto-assigned numerical reference

Value:
Internal id based on instance count.

See also:

state

public state : String (read-only)
Retrieves a Fuse instance's current play-state string.

Value:
"stopped", "playing", or "paused"

See also:

target

public target : Object (read, write)
インスタンスのデフォルト設定:Sets one or more animation targets that will be used for any actions that don't specify their own.

Overwrites prior existing targets.
var f:Fuse = new Fuse();
f.target = [clip1, clip2];

Value:
a single animation target if one is set or an Array of targets if more than one is set.ターゲットが1つの時はインスタンス名、複数の時は配列

See also:


Constructor Documentation

Fuse

function Fuse (fuseAction:Object [, fuseAction:Object, etc...])
Fuse は Array クラスをを拡張したもので、シーケンシャルなアニメーションを可能にし、push()などのおなじみのメソッドを使って管理できます。

使い方:
// セットアップ作業 - FLA 内で一度だけ設定すればOK
import com.mosesSupposes.fuse.*;
ZigoEngine.register( Fuse, PennerEasing );

// box1_mc に対して、簡単なイントロシーケンスを設定
var f:Fuse = new Fuse();
f.label = "swoopyIntro";
f.target = box1_mc;

f.push({ delay: .25 });

// ラベルは、いくつかのメソッドで利用することがありますが、ほとんどは便宜性の為に指定することが多いです
f.push({ label: "appear",
         start_scale: 500,
         start_alpha: 0,
         time: 1.75,
         ease: "easeOutBack",
         trigger: .5 // advances this action early
        });


// the array brackets in this action form a group of parallel tweens
f.push([ 
        { label: "swoop",
          x: "80",
          controlY: "50", // ベジェカーブを追加
          time: 1.5,
          ease: "easeInOutBack"
         },
          
        // 以下のトゥイーンは 2 cycles 指定により、往復することになります
        { brightOffset: 50,
          rotation: 10,
          ease: "easeInOutQuad",
          cycles: 2,
          time: .5,
          delay: .25 
        }
       ]);

// シンプルなコールバックのやり方。"onComplete" イベントを記述することでも可能です
f.push({ func:"trace", args:"done!" });

f.traceItems();
f.start(true); // passing true presets start props - remove it to see a change.
上記の Fuse をスタートさせると、以下のように出力されます:
-Fuse "swoopyIntro" traceItems:
----------
-Fuse "swoopyIntro">Item #0: Elements:[delay]
-Fuse "swoopyIntro">Item #1 "appear": Elements:[trigger] StartProps:[_alpha, _scale] Props:[_scale, _alpha]
-Fuse "swoopyIntro">Item #2 "swoop": Props:[_brightOffset, _rotation, _bezier_]
-Fuse "swoopyIntro">Item #3: Elements:[callback]
----------
done!
Once a Fuse Array contains at least one action it is controllable with the play methods start, stop, pause, resume, skipTo, and fastForward. Fuses dispatch the events listed at the top of this page during their play cycle. Start properties can be preset for all or a specific subset of actions, using the setStartProps method or during any start call. (If true were not passed during start in the example above, the target would be visible during the short delay in the first action.) Note that end values are omitted in the "appear" action, making use of Fuse's smart parsing to keep actions concise. Actions can be further condensed with the use of instance defaults duration, easing, target, and scope.

The power of Object Syntax is structural. It in fact has few parameters of its own — label, target/addTarget, event/eventparams, trigger, command and a few extra time-notation options. Standard ZigoEngine tweening parameters, including user-defined variables, make up the bulk of what you'll see listed in any action. You can expect Object Syntax's features to be logical, intuitive and useful.

± Getting started with Object Syntax

± Object Syntax Mechanics (advanced topic)

± Working with asynchronous events (advanced topic)


オブジェクトシンタックスの詳細

Fuse action objects may be:
  • パース可能なプロパティを含む一般的なオブジェクト
    { target:clip1, x:10, seconds:2, ease:Strong.easeInOut }
  • 同時に実行させたいトゥイーンのグループ、その複数アクションオブジェクトの配列
    [ { x:10, seconds:2, ease:Strong.easeInOut }, { start_alpha:0, seconds:.5 } ]
  • あるアクションの中で再生させるためにネスト化した Fuse
    myFuse2

    Fuse は制限なくネスト構造化することができます - 例えば、myFuse2 内で myFuse3 を実行、さらにその myFuse3 に myFuse4

    Nested Fuses many not appear within groups (the Array syntax in the previous point). However it is quite possible to start secondary Fuses from any action or action group with commands like { scope:myFuse2, func:"start" }. より複雑な例をご覧になりたい方は command パラメーターの項をご覧ください。
  • "Applied actions": a special format for reusing actions by including an action property.

    For example if an action var intro:Object = { ... } を設定した時、you can then include it in later Fuse actions like this:
    { target:clip1, action:intro }

    This lets you build multi-purpose behaviors that can be used with different targets, perhaps a custom fade or movement effect.
    Applied actions may contain the following properties that modify the base action: delay, target, addTarget, label, trigger.
    While target overrides, addTarget concatenates targets with any that are defined in the action. See below for info on other properties.

    Applied actions may be included in groups; the action property can also be an array itself. Note that "runtime evaluation" (below) is not supported with the action property itself, although sub-properties in the applied action may make use of that feature.

Fuse action-object properties may be:
  • Parseable properties 以下に記載
  • Any custom property you wish to tween (should be pre-declared and set to a number)
  • Start values: Prepend start_ to any property and it will be set prior to tweening.
  • Omitted: Fuse's smart parsing allows you to avoid needing a start and end value for every property. When a start value is omitted, the property's current value is used as in ZigoEngine. When a start-value is included but the end value is omitted, Fuse inserts an end value in one of two ways:
    • Natural reset: Known properties with a natural reset value like _rotation:0, _alpha:100, _brightOffset:0, etc., auto-fill the end value as such. For example a fade-in effect can be generated with the simple action {start_alpha:0} which will tween to 100 automatically.
    • Open properties: Props like _x or _width that do not have a natural reset are auto-filled to their value prior to the tween. In this action a clip will be moved offscreen then slide back to its current location: { start_x:-100, start_y:-100 }.

Fuse action-object values may be types:
  • Number - a tween's end position. x:100
  • String - calculate tween using relative positioning.
    Example: rotation:"-90" yields a counter-clockwise rotation.
  • Boolean values, set at start or end of tween.
    Example: start_visible:true
  • Tint values can be Number (0x000000), String ("#000000"), or null (reset)
    Example: tint:"#FF3300"
  • Time is specified in seconds, and may be Number or timecode-String format.
    Examples: seconds:2, startAt:"01:75" - timecode for a 1.75-second delay
  • Function - (Advanced) "Runtime evaluation" - function is queried as the action is played in the sequence. Functions should return values appropriate to the property.
    Example: { x:function(){ return _root._xmouse; } }

    This is a powerful feature that helps eliminate the need to hardcode values in advance. Fuses can be written to be "live", querying for targets and values themselves by retrieving state variables from within your program.

    Such functions will be scoped first to the action then the Fuse instance's scope property. If scope is already being used for callbacks, you can use a Delegate to individually scope runtime-evaluation functions.
  • 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.
    Examples: { myArray:[10,20], myMatrix:{a:0, b:1, tx:100}, GradientBevel_colors:[0xFF0000, 0x333333, 0x00FFFF] }
  • 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: { myColors: [ 0x000000, 0xFFFFFF ], scope:this, updfunc:'redrawGradient' }

パース可能なプロパティ:
  • label アクションの ID となる文字列で、skipTo や fastForward メソッドで実際に利用します。Fuse ではグループは単独のアクションと見なされます。(To label a group include a label within any of its sub-actions.) 出力ウィンドウにラベル名を表示されることができるので便利です。
  • target アニメーションさせるターゲットやターゲットを格納した配列。Overrides the instance's default target list.
  • addTarget デフォルトの target リストに、1つまたは複数ターゲットの配列を追加することができます。
  • ease or easing Accepts same formats as ZigoEngine.doTween's easing parameter.
  • seconds, time or duration 上記 time フォーマットの項をご覧ください。
  • delay or startAt 上記記事を参照して下さい。
  • event String declaring a custom event that should be dispatched by the engine.
    Subscribe to this custom event on the Fuse instance the same as you would for built-in events (see header).

 

  • func 関数。関数名を文字列で、または Easyfunc 文字指定: "myClip.doSomething(true);" (easyfunc 機能を使うには Shortcuts クラスを登録しておく必要があります。)
  • scope オブジェクト - デフォルトのスコープ を上書きできます。Note that in Fuse actions this property is special in that it will be applied to all callbacks or runtime-evaluation functions if not otherwise defined.
  • args func コールバックに渡す引数または複数の引数の配列。
  • startfunc 待機時間後にトゥイーンが開始されたタイミングで実行されるコールバック。多くのフォーマットをサポートしています - 上記 func の項をご覧ください。
  • startscope この scope プロパティが未定義の場合は、インスタンスのデフォルトの scope が利用されます。
  • 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 If not defined, the scope property or instance default scope will be used.
  • updargs One argument or an array of arguments to pass to the updfunc callback.
  • 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.
  • _bezier_ (Not necessary, see controlX, controlY below.) Generic object with some or all of the properties {x:,y:,controlX:,controlY:}. Relative (string) values are okay. Note that only one control param is necessary to generate a curved motion path.
  • controlX, controlY Including one or both of these parameters in a Fuse action along with x and/or y generates a bezier curve similar to using the _bezier_ property but without the need for a nested object.
  • cycles 2以上の整数で指定します。指定した数だけ、始点と終点を往復トゥイーンさせることができます。無限ループ(ZigoEngine.doTween では 0 や "LOOP" と指定できる)は Fuse では使用できません。
  • roundResults Overrides the class setting ZigoEngine.ROUND_RESULTS for an individual action. 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.
  • skipLevel 0,1, or 2. An advanced behavior setting for cases where tweens fail. See ZigoEngine.SKIP_LEVEL for details. In Fuse, this parameter also applies to the custom event parameter, although standard Fuse events like onComplete are not skipped.
  • trigger May be set as seconds (see time formatting above) or set to true if in a group to indicate advance after the item trigger is grouped with.
    Advances the sequence prior to action completion. This is a powerful feature that makes sequencing far less rigid and more timeline-like.
    Example 1: In this group the sequence advances after the fade action. [ { start_alpha:0, seconds:.5, trigger:true}, { x:'100', seconds:3 } ]
    Example 2: Here the sequence advances after 1.5 seconds, while the action takes 3 seconds. { width:500, delay:1, seconds:2, trigger:1.5 }

    Note that the onComplete Fuse event is not fired until any trailing tweens from triggered actions finish.
  • command String "start","stop","pause","resume","skipTo", or "setStartProps".
    Allows actions to control Fuse play.
    Example: a final action of {command:"start"} causes the Fuse to loop.
    Commands should be separate actions. They may not appear within action groups or be blocked with tweens or callbacks.
    Actions containing a command property may ONLY contain the additional properties: scope, args, label, delay.
    Note that any arguments in args are sent to the Fuse command, and scope is only used for runtime-evaluation of other params set to function (see "Runtime-evaluation" above).

    Examples of a command with an argument: { command:"skipTo", args:3 }, { command:"start", args:true }
  • easyfunc Removed from kit. func, startfunc, updfunc parameters now accept easyfunc strings (see func above).
(Advanced) The following example illustrates how command actions can be used in more complex arrangements. Here a complex group of Fuses is associated by controlling each other, without the use of nested Fuses.
var fuseA:Fuse = new Fuse();
var fuseB:Fuse = new Fuse();
var fuseC:Fuse = new Fuse();
// .. build Fuses here then..
// final action in fuseC will resume the master Fuse,
fuseC.push({ scope:fuseA, func:"resume" });
// .. somewhere in fuseA, begin the others & pause:
fuseA.push([{scope:fuseB, func:"start"},
				 {scope:fuseC, func:"start"} ]);
fuseA.push({ command:"pause" }); // keep command in a separate action
// .. continue pushing actions into fuseA here.
// .. fuseA will resume when fuseC hits its final "resume" action.

FuseItem.ADD_UNDERSCORES を false に設定すると、アクションを使う際、 オプションで 下記に挙げるおなじみのプロパティのアンダースコアを省略することが可能です。 listed here without. For descriptions of ZigoEngine properties (shown in bold), look up their underscored counterparts in ZigoEngine.doTween.
  • alpha
  • brightOffset
  • brightness
  • colorReset
  • colorTransform
  • contrast
  • fade
  • frame
  • height
  • invertColor
  • rotation
  • scale
  • size
  • tint
  • tintPercent
  • visible
  • width
  • x
  • xscale
  • y
  • yscale

Parameters:
fuseAction
One or more generic "action" objects or arrays in Fuse Object Syntax constituting a sequence.
See also:


Method Documentation

addCommand

public static function addCommand (commandOrScope: Object,
 indexOrFunc: Object,
 argument: Object): Void

非アニメーション用の多目的用途のシンプルシンタックス機能です。

Usage

var f:Fuse = new Fuse();
 
// callback: scope, func, args
Fuse.addCommand(this, "setItemData", 0, "Submit", true);
 
// delay
Fuse.addCommand("delay", .5);
 
// inline Fuse play-command: 
// this final action will cause the Fuse to loop
Fuse.addCommand("start");
 
// advance-trigger (should appear within group)
Fuse.addCommand("trigger", .5);

Some addCommand calls are allowed inside groups ('delay','trigger', function-calls), but most are not. For instance if you want to have a Fuse pause itself, place the command Fuse.addCommand('pause'); outside any Fuse.openGroup(); blocks.

The 'trigger' feature should appear within groups and adds powerful flexibility for animators:

Just as delays can stagger the start times of grouped tweens, triggers allow the ends of grouped animations to overlap with the following action by advancing the action early. For example if an action contains two tweens, the longest of which is 2 seconds plus a 1-second delay, including Fuse.addCommand("trigger", 2.5); in the group would advance the Fuse to the next action half a second before the running tweens complete. This adds timeline-like flexibility and helps you keep your sequences less rigid.

Parameters:
commandOrScope
Accepts: 'delay','trigger','start','stop','pause','resume','skipTo','setStartProps' or in the case of a function-call a scope such as this.
indexOrFunc
Varies based on first argument: 'delay', 'trigger' : Number of seconds. 'skipTo': Destination index (starting at 0 for the first action). For function-call, a string of the function name such as 'trace'.
argument
Function-call: Any number of arguments can follow and will be passed during the call.
See also:

addEventListener

public function addEventListener (event: String,
 handler: Object): Void
特定のイベント用にリスナーを追加します。

Parameters:
event
the name of the event ("onComplete", etc)
handler
the function or object that should be called
See also:

addTarget

public function addTarget (t: Object): Void
現在のターゲットリストにターゲットを追加します。

myFuse.addTarget(clip5);

Parameters:
t
1つのターゲット、または複数ターゲットを格納した配列
See also:

clone

public function clone (): Fuse
Returns a copy of Fuse as a new Fuse instance.

Returns:
new Fuse instance with default settings and actions.

See also:

close

public static function close (): Void
シンプルシンタックス:open を使って生成された Fuse を閉じ、Fuse インスタンス生成完了です。

重要なことですが、Fuse.open() を使って生成開始された Fuse は、Fuse.close()Fuse.closeAndStart()のどちらかを使って閉じてはじめて、 Fuse インスタンスの生成完了となります。閉じることなく、 オープンされたままの Fuse インスタンスを start させることはできません。
var runSetup:Fuse = Fuse.open();
Fuse.addCommand(this, "callbackOne");
Fuse.addCommand("delay", .25);
Fuse.addCommand(this, "callbackTwo");
Fuse.addCommand("delay", .25);
Fuse.addCommand(this, "callbackThree");
Fuse.close();
 
// その後、プログラム中のどこかで、、
runSetup.start(); // reference the Fuse created

See also:

closeAndStart

public static function closeAndStart (setStart: Object): Void
シンプルシンタックス:open された Fuse インスタンスを閉じ、そのまま再生を開始します。

var runSetup:Fuse = Fuse.open();
clip1.fadeOut();
clip2.fadeOut();
clip3.fadeOut();
Fuse.closeAndStart();

Parameters:
setStart
A setStartProps call is generated from all arguments before the Fuse begins playing.
See also:

closeGroup

public static function closeGroup (): Void
シンプルシンタックス:openGroup を使ってグループ化されてきたアクショングループを閉じます。

May be omitted if followed by Fuse.close or Fuse.closeAndStart.

If Fuse.openGroup() is called while a previous group was open, the preceding group is closed automatically and the closeGroup command can be skipped.
Fuse.open();
clip1.tween("_x","100");
Fuse.openGroup();
 clip1.tween("_x","-100");
 clip2.tween("_scale",200);
Fuse.closeGroup();
clip1.scaleTo(0);
clip2.scaleTo(0);
Fuse.closeAndStart();

See also:

destroy

public function destroy (): Void
Deletes all variables and properties in the Fuse instance.

使い方:
You should remove all listeners before calling destroy(), then after the call delete any variable references to the instance cleared.
myFuse.removeEventListener('onComplete',this);
myFuse.destroy();
delete myFuse;

See also:

fastForward

public function fastForward (resumeAtIndexOrLabel: Object): Void
残り全てのアクションを早送りして飛ばします。

Behavior:
  • 引数は必要ありません:残り全ての Fuse アニメーションを飛ばします。onComplete イベントが呼び出されます。
  • Passing a positive or negative integer or string: Fast-forwards up to, then resumes play at the index specified. Negative integer counts back from last item, string locates an action or nested Fuse by its label property.
  • Callbacks and events are disregarded during fast-forwarding.
  • If you pass 0 or an index that has already played, a warning is thrown and skipTo is called instead.
  • Note that when passing a label string, nested Fuse instance labels are scanned but not action labels within nested Fuses. To fast-forward to a specific point in a nested Fuse, first call fastForward to advance to the primary Fuse, then a second time on the secondary Fuse.
  • Fuse does not include any similar animation-rewinding method, which would not be practical for a number of reasons within its current architecture.

使い方:
// 全てのアニメーションをスキップ、該当 Fuse インスタンスを終了します:
myFuse.fastForward();
 
// 現在再生中のアニメーションから、8番目までをスキップ。8番目から再生を開始します:
myFuse.fastForward(8);
 
// { x:"100", label:"slider" }のようにラベリングされたアクションがある部分までをスキップ、そこから再生します:
myFuse.fastForward("slider");
 
// 早送りしますが、最後のアクションだけは再生します
myFuse.fastForward(-1);
The following example demonstrates fast-forwarding to an index within a nested Fuse instance, and also shows how a nested Fuse's label property can be used to fast-forward to. Note that the fast-forward commands could alternatively be written using positive or negative integers as in the examplese above.
var nestedFuse1:Fuse = new Fuse(
	{ rotation:180, label:"spin" },
	{ tint:0x33FF00, tintPercent:50, label:"tint" }
);
nestedFuse1.label = "NF1";
nestedFuse1.target = clip1_mc;
 
var mainFuse:Fuse = new Fuse(
	{ x:"100", label:"slideRight" },
	nestedFuse1,
	{ x:"-100", label:"slideLeft" }
);
mainFuse.target = clip1_mc;
mainFuse.start();
 
// fast-forward to the "tint" action by using two fastForward calls.
mainFuse.fastForward("NF1"); // first jump to the nested Fuse using its label
nestedFuse1.fastForward("tint"); // then jump to the tint action using its label

Parameters:
resumeAtIndexOrLabel
Numerical item index or label string to fast-forward up to and resume playing at.
See also:

getActiveTargets

public function getActiveTargets (includeDefaults: Boolean): Array
Gets both the default target list and any targets in the action currently being played.

Parameters:
includeDefaults
If true is passed, list includes the Fuse instance's default target list plus active action targets.
Returns:
Array of targets currently being handled by the playing or paused action, plus the Fuse instance's default target list if true was passed.

If the Fuse instance queried is stopped, an empty array is returned.

See also:

getInstance

public static function getInstance (idOrLabel: Object): Fuse
Instance-management: Gets a Fuse instance by its id or label

This simple method returns one known Fuse instance. For more complex options use getInstances.

Parameters:
idOrLabel
Fuse's numerical id or label identifying a unique Fuse instance.
Returns:
a Fuse instance if found or null if not

See also:

getInstances

public static function getInstances (stateFilter: String,
 targets: Object): Array
Instance-management: Get an array of some or all Fuse instances in active memory, with filtering options.

// get currently playing Fuses that handle the target my_mc
var myMcFuses:Array = Fuse.getInstances("playing",my_mc);
 
// get all the Fuses in active memory
var fuses:Array = Fuse.getInstances();

Parameters:
stateFilter
nothing/null/FuseKitCommon.ALL for all Fuse instances in active memory, or a play state "playing", "stopped" or "paused"
targets
optional - a single target, an Array of targets, or a list of targets starting with the second param.
Returns:
an array containing one or more Fuse instances matching search criteria

See also:

open

public static function open (fuseOrID: Object): Fuse
Simple Syntax:Generate a new Fuse and begin intercepting tween calls until close is called.

Simple Syntax is an alternative way to construct Fuse sequences. Its primary uses are 1. Clear method-call sequencing and 2. An easy way for non-advanced coders to set up sequences.

使い方:
// Example 1: Can be used to enforce a clear, strict order of timed events
Fuse.open();
 Fuse.addCommand (mainMenu, "draw", menuXML);
 Fuse.addCommand ("delay", .5);
 Fuse.addCommand (contentPage, "loadContent", firstItem);
 Fuse.addCommand (screenDisplay, "exposeLayout");
 Fuse.addCommand ("delay", 2);
 Fuse.addCommand (this, "onResize");
 Fuse.addCommand (Logger, "output", "Setup sequence complete.", 0);
Fuse.close();
 
// Example 2: Simple Syntax with shortcut tweens
Fuse.open();
 box_mc.slideTo(150,150, 1);
 Fuse.openGroup();
  box_mc.scaleTo(250, 1);
  box_mc.brightnessTo(-50, 2);
 Fuse.closeGroup();
 box_mc.colorTo(0x6633FF, 1);
Fuse.closeAndStart();

You may retrieve the Fuse instance created, or reopen an existing Fuse:
var f:Fuse = Fuse.open(); // store a reference to the Fuse
// later...
Fuse.open(f); // reopen existing
// or...
Fuse.open(0); // open Fuse with id 0
// or...
Fuse.open("introSequence"); // open Fuse with the label "introSequence"

If you mostly use simple syntax and don't reuse your Fuses, it's recommended that you set AUTOCLEAR to true to avoid memory buffering.

Parameters:
fuseOrID
(Optional) Pass an existing Fuse, or its id or label to reopen it.
Returns:
The opened Fuse instance that tween calls will be routed to until close() is called.

See also:

openGroup

public static function openGroup (fuseOrID: Object): Fuse
シンプルシンタックス:同時に実行させるアクショングループの定義を開始できます。

Fuse.openGroup();Fuse.open();の代わりに使うことができます。

前のグループが open なままの状態で、さらに Fuse.openGroup();した時は、前のグループは自動的に閉じられます。
// Fuse.open() の代わりに、新規 Fuse を生成することができます。
Fuse.openGroup();
 clip1.tween("_x","100");
 clip2.tween("_scale",200);
Fuse.openGroup(); // 他のグループが開いている時、そのグループの closeGroup を省略できます。
 clip1.tween("_x","-100");
 clip2.tween("_scale",100);
Fuse.closeAndStart(); // ここでも closeGroup を省略しています。

Parameters:
fuseOrID
fuseOrID:Fuse (Optional) an existing Fuse or Fuse's id or label in which to open the new group.
Returns:
今開いている Fuse インスタンス。open() されていない時に openGroup した時は、新規 Fuse インスタンス。

See also:

pause

public function pause (): Void
再生コントロール:再生中の Fuse インスタンスと実行中のトゥイーンを一時停止します。再開するには resume メソッドを呼び出して下さい。

See also:

pop

public function pop (): Object
Fuse の最初の要素を削除、できたアクションオブジェクトを返します。

Returns:
original object passed by user

See also:

push

public function push (fuseAction:Object [, fuseAction:Object, etc...]): Number
Fuse の末尾に1つ以上の要素を追加し、追加後の Fuse の length を返します。
使い方:
myFuse.push({ x:"100" }); // シーケンスの最後にアクションを追加
Parameters:
fuseAction
One or more generic "action" objects or arrays in Fuse Object Syntax starting at this argument
Returns:
追加後の新規 Fuse インスタンスの length

See also:

pushTween

public function pushTween (targets: Object,
 props: Object,
 endvals: Object,
 seconds: Number,
 ease: Object,
 delay: Number,
 callback: Object): Number
Lets you add an item to the Fuse in ZigoEngine.doTween() syntax. Pushes tween arguments into Fuse instance and accepts the same arguments as ZigoEngine.doTween().

Parameters:
targets
tween target object or array of target objects
props
tween property or Array of properties
endvals
tween end-value or Array of corresponding end-values
seconds
tween duration
ease
function, shortcut-string, or custom-easing-panel object
delay
seconds to wait before performing the tween
callback
function, string, or object
Returns:
new length of Fuse instance

See also:

removeEventListener

public function removeEventListener (event: String,
 handler: Object): Void
Remove a listener for a particular event

Parameters:
event
the name of the event ("onComplete", etc)
handler
the function or object that should be called
See also:

removeTarget

public function removeTarget (t: Object): Void
現在のターゲットリストから、指定したターゲットを削除します。

myFuse.removeTarget(clip5);

Parameters:
t
ターゲット単品やターゲットの配列で、指定できます。
See also:

resume

public function resume (): Void
一時停止された Fuse インスタンスとそのアニメーションを再開できます。Attempts to correct for animations that have been disrupted during pause.

See also:

reverse

public function reverse (): Void
Fuse のシーケンスの順番を逆転できます。

See also:

setStartProps