import mx.events.EventDispatcher;
import mx.utils.Delegate;
import com.mosesSupposes.fuse.actionscript_video_com_mosesSupposes_fuse_FuseItem;
import com.mosesSupposes.fuse.actionscript_video_com_mosesSupposes_fuse_FuseKitCommon;
/**
*
* The actionscript_video_com_mosesSupposes_fuse_Fuse Kit [beta1.1z3]
* Copyright (c) 2006 Moses Gunesch, MosesSupposes.com
*
* Distributed under MIT Open Source License, see actionscript_video_com_mosesSupposes_fuse_Fuse_Kit-License.html (in fuse package directory)
* Easing Equations (c) 2003 Robert Penner used by permission, see PennerEasing
* Visit http://www.mosessupposes.com/actionscript_video_com_mosesSupposes_fuse_Fuse
*
* @ignore
*
* Event & animation sequencer that extends Array.
*
* @usage
* To enable animation sequencing, pass actionscript_video_com_mosesSupposes_fuse_Fuse to {@link com.mosesSupposes.fuse.ZigoEngine#register} or {@link com.mosesSupposes.fuse.ZigoEngine#simpleSetup}.
*
* Events dispatched:
*
onStart
onStop
onPause
onResume
onAdvance
onComplete
var f:actionscript_video_com_mosesSupposes_fuse_Fuse = new actionscript_video_com_mosesSupposes_fuse_Fuse(); * f.addEventListener("onComplete", myListenerObj);*
var f:actionscript_video_com_mosesSupposes_fuse_Fuse = new actionscript_video_com_mosesSupposes_fuse_Fuse(); * f.autoClear = true;* In this example, the fuse instance f will delete itself after it plays through once, at which time you should also delete the variable
f
to prevent memory buffering issues.
* @see #AUTOCLEAR
*/
public var autoClear:Boolean = false;
/**
* Instance default: scope for all functions run from a actionscript_video_com_mosesSupposes_fuse_Fuse if left unspecified within the action.
* @usage
* var f:actionscript_video_com_mosesSupposes_fuse_Fuse = new actionscript_video_com_mosesSupposes_fuse_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 actionscript_video_com_mosesSupposes_fuse_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. * @see #actionscript_video_com_mosesSupposes_fuse_Fuse */ public var scope:Object; /** * Internal id based on instance count. */ private var _nID:Number; /** * Internal sequence play-index. */ private var _nIndex:Number; /** * Internal, can be "stopped", "playing", or "paused". */ private var _sState:String = 'stopped'; /** * Internal list of instance's default animation targets, set using public setter target or addTarget method. */ private var _aDefaultTargs:Array; /** * Internal setInterval id for delays run by actionscript_video_com_mosesSupposes_fuse_Fuse. (Delays in groups or with tweens are handled by actionscript_video_com_mosesSupposes_fuse_FuseItem.) */ private var _nDelay:Number = -1; /** * Internal storage used for tracking a delay's current time during pause(). */ private var _nTimeCache:Number = -1; /** * Stores a Delegate function used to trap nested actionscript_video_com_mosesSupposes_fuse_Fuse's onComplete event (stored for later removal during destroy()). */ private var _oDel1:Object; /** * Static list of all actionscript_video_com_mosesSupposes_fuse_Fuse instances created, publicly accessible via getInstance() and getInstances() and used by remote methods like open(). */ private static var _aInstances:Array = null; /** * Internal storage of Build Mode (Simple Syntax) params curID:Number (often queried to find out if Build Mode is active), prevID:Number, curGroup:Array. */ private static var _oBuildMode:Object = null; /** * Written in during EventDispatcher.initialize(). */ private var dispatchEvent:Function; /** * actionscript_video_com_mosesSupposes_fuse_Fuse extends Array to enable sequence-building & mangaement using familiar methods like
push()
.
* @param action One or more generic "action" objects or arrays in actionscript_video_com_mosesSupposes_fuse_Fuse Object Syntax constituting a sequence.
* @usage
* * var f:actionscript_video_com_mosesSupposes_fuse_Fuse = new actionscript_video_com_mosesSupposes_fuse_Fuse( * {start_x:'-50', start_xscale:150, start_alpha:0, seconds:.5 }, * [ * { width:500, ease:'easeInExpo', seconds:1 }, * { height:300, ease:'easeInOutExpo', delay:.5 } * ]); * f.target = box1_mc; * f.start(); * * f.traceItems();* Outputs: *
-actionscript_video_com_mosesSupposes_fuse_Fuse#0 traceItems: * ---------- * actionscript_video_com_mosesSupposes_fuse_Fuse#0>Item#0: StartProps:[_alpha, _xscale, _x] Props:[_x, _xscale, _alpha] * actionscript_video_com_mosesSupposes_fuse_Fuse#0>Item#1: Props:[_height, _width] * ----------*
{ target:clip1, x:10, seconds:2, ease:Strong.easeInOut }
[ { x:10, seconds:2, ease:Strong.easeInOut }, { start_alpha:0, seconds:.5 } ]
action
property.var intro:Object = { ... }
has been defined,
* you can then include it in later actionscript_video_com_mosesSupposes_fuse_Fuse actions like this:{ target:clip1, action:intro }
delay, target, addTarget, label, trigger
.target
overrides, addTarget
concatenates targets with any that are defined in the action. See below for info on others.start_
to any property and it will be set prior to tweening.x:100
rotation:"-90"
yields a counter-clockwise rotation.start_visible:true
0x000000
), String ("#000000"
), or null
(reset)tint:"#FF3300"
seconds:2
, startAt:"01:75"
- timecode for a 1.75-second delay{ x:function(){ return _root._xmouse; } }
scope
property.
* If scope
is already being used for callbacks, you can use a Delegate to individually scope runtime-evaluation functions.label
String naming the action, that may be used during {@link #skipTo} and viewed in output messages. (This property cannot be set to a function value)target
Animation target or Array of targets. Overrides the instance's default {@link #target} list.addTarget
Concatenates one or an Array of targets with the default {@link #target} list.ease or easing
Accepts same formats as {@link com.mosesSupposes.fuse.ZigoEngine#doTween}'s easing parameter.seconds, time or duration
See time formatting above.delay or startAt
See time formatting above.event
String declaring a custom event that should be dispatched by the engine.eventparams
An object whose properties will be copied to the event object dispatched with the custom event. (Requires that the event
property is defined)func
Function or string name of functionscope
Object - overrides instance default {@link #scope}. Note that in actionscript_video_com_mosesSupposes_fuse_Fuse actions this property is special in that it will be applied to all callbacks or runtime-evaluation functions if not otherwise defined.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.startscope
If not defined, the scope
property or instance default {@link #scope} 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.updscope
If not defined, the scope
property or instance default {@link #scope} will be used.updargs
One argument or an array of arguments to pass to the updfunc
callback.easyfunc
String like "myClip.doSomething(true);"
. ({@link com.mosesSupposes.fuse.Shortcuts} must be registered to use this feature)extra1
Elastic easing amplitude or Back easing overshootextra2
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 actionscript_video_com_mosesSupposes_fuse_Fuse 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
An integer 2 or higher, tweens back and forth between start and end positions. Infinite cycles (0 or "LOOP" in {@link com.mosesSupposes.fuse.ZigoEngine#doTween}) are not allowed in actionscript_video_com_mosesSupposes_fuse_Fuses.skipLevel
0,1, or 2. See {@link com.mosesSupposes.fuse.ZigoEngine#SKIP_LEVEL} for details. In actionscript_video_com_mosesSupposes_fuse_Fuse, this parameter also applies to the custom event
parameter, although standard actionscript_video_com_mosesSupposes_fuse_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.[ { start_alpha:0, seconds:.5, trigger:true}, { x:'100', seconds:3 } ]
{ width:500, delay:1, seconds:2, trigger:1.5 }
onComplete
actionscript_video_com_mosesSupposes_fuse_Fuse event is not fired until any trailing tweens from triggered actions finish.command
String "start","stop","pause","resume","skipTo","setStartProps"
.{command:"start"}
causes the actionscript_video_com_mosesSupposes_fuse_Fuse to loop.command
property may ONLY contain the additional properties: scope, args, label, delay
.args
are sent to the actionscript_video_com_mosesSupposes_fuse_Fuse command, and scope
is only used for runtime-evaluation of other params set to function (see "Runtime-evaluation" above).actionscript_video_com_mosesSupposes_fuse_FuseItem.ADD_UNDERSCORES
to false, the following known properties are underscore-optional:
* _alpha or alpha
_rotation or rotation
_x or x
_y or y
_xscale or xscale
_yscale or yscale
_scale or scale
Sets _xscale and _yscale to the same value_width or width
_height or height
_size or size
Sets _width and _height to the same value_frame or frame
Tweens a MovieClip's timeline to a frame using easing specified._tint or tint
Tint formats above or object {tint:Number/null/hexString, percent:Number/String}
._tintPercent or tintPercent
Value range 0-100_brightness or brightness
Value range 0-100_brightOffset or brightOffset
Burn effect. -100=black, 0=normal, 100=white_invertColor or invertColor
Value range 0-100_colorReset or colorReset
Value ranges from 0 (current tint) to 100 (full reset)._contrast or contrast
0=gray, 100=normal, 200=high-contrast, higher=posterized_colorTransform or colorTransform
Flash7 transform object {ra:,rb:,etc.}
_visible or visible
* myactionscript_video_com_mosesSupposes_fuse_Fuse.removeEventListener('onComplete',this); * myactionscript_video_com_mosesSupposes_fuse_Fuse.destroy(); * delete myactionscript_video_com_mosesSupposes_fuse_Fuse; ** @see #autoClear * @see #AUTOCLEAR * @see #getInstance */ public function destroy():Void { if (actionscript_video_com_mosesSupposes_fuse_Fuse.OUTPUT_LEVEL>1) actionscript_video_com_mosesSupposes_fuse_FuseKitCommon.output('-actionscript_video_com_mosesSupposes_fuse_Fuse#'+String(_nID)+' destroy.'); this.stop(true); splice(0,length); _aDefaultTargs = null; scope = null; // required for stripping listeners. 0,7 is not a mistake - do not change _global.ASSetPropFlags(this,null,0,7); var id:Number = _nID; for (var i:String in this) delete this[i]; removeInstanceAt(id, true); delete id; delete this; } /** * Deprecated. Returns error from actionscript_video_com_mosesSupposes_fuse_FuseKitCommon. * @deprecated Use new setup options: {@link com.mosesSupposes.fuse.ZigoEngine#register} or {@link com.mosesSupposes.fuse.ZigoEngine#simpleSetup}. */ public static function simpleSetup():Void { actionscript_video_com_mosesSupposes_fuse_FuseKitCommon.error('101'); } /** * Instance-management: Gets a actionscript_video_com_mosesSupposes_fuse_Fuse instance by its id or label * @description This simple method returns one known actionscript_video_com_mosesSupposes_fuse_Fuse instance. For more complex options use {@link #getInstances}. * @param idOrLabel actionscript_video_com_mosesSupposes_fuse_Fuse's numerical {@link #id} or {@link #label} identifying a unique actionscript_video_com_mosesSupposes_fuse_Fuse instance. * @return a actionscript_video_com_mosesSupposes_fuse_Fuse instance if found or null if not * @see #getInstances */ public static function getInstance(idOrLabel:Object):actionscript_video_com_mosesSupposes_fuse_Fuse { if (typeof idOrLabel=='number') return _aInstances[idOrLabel]; if (typeof idOrLabel=='string') { for (var i:String in _aInstances) if (actionscript_video_com_mosesSupposes_fuse_Fuse(_aInstances[i]).label==idOrLabel) return _aInstances[i]; } return null; } /** * Instance-management: Get an array of some or all actionscript_video_com_mosesSupposes_fuse_Fuse instances in active memory, with filtering options. * @description *
// get currently playing actionscript_video_com_mosesSupposes_fuse_Fuses that handle the target my_mc * var myMcactionscript_video_com_mosesSupposes_fuse_Fuses:Array = actionscript_video_com_mosesSupposes_fuse_Fuse.getInstances("playing",my_mc); * // get all the actionscript_video_com_mosesSupposes_fuse_Fuses in active memory * var fuses:Array = actionscript_video_com_mosesSupposes_fuse_Fuse.getInstances();* @param stateFilter nothing/null/{@link com.mosesSupposes.fuse.actionscript_video_com_mosesSupposes_fuse_FuseKitCommon#ALL} for all actionscript_video_com_mosesSupposes_fuse_Fuse instances in active memory, or a play state "playing", "stopped" or "paused" * @param targets optional - a single target, an Array of targets, or a list of targets starting with the second param. * @return an array containing one or more actionscript_video_com_mosesSupposes_fuse_Fuse instances matching search criteria * @see #getInstance */ public static function getInstances(stateFilter:String, targets:Object):Array { var all:Boolean = (stateFilter==null || (stateFilter.toUpperCase())=='ALL'); if (!(targets instanceof Array)) targets = arguments.slice(1); var a:Array = []; for (var i:String in _aInstances) { var instance:actionscript_video_com_mosesSupposes_fuse_Fuse = _aInstances[i]; if (_aInstances[i]==null) continue; // if specified state does not match if (all==false && instance.state!=stateFilter) continue; // yes: state matches and no targets to filter by var found:Boolean = (targets.length==0); if (found==false) { // AS2 bug, break does not work twice! if (found==true) continue; var instTargs:Array = instance.getActiveTargets(true); for (var j:String in targets) { for (var k:String in instTargs) { // yes: a target passed in was found in the instance if (instTargs[k]==targets[j]) { found = true; break; } } } } if (found==true) a.unshift(instance); } return a; } /** * Instance default: an auto-assigned numerical reference * @return Internal id based on instance count. * @see #label * @see #getInstance */ public function get id():Number { return _nID; } /** * Retrieves a actionscript_video_com_mosesSupposes_fuse_Fuse instance's current play-state string. * @return
"stopped", "playing", or "paused"
* @see #currentIndex
*/
public function get state():String { return _sState; }
/**
* Retrieves the current play-index of a actionscript_video_com_mosesSupposes_fuse_Fuse instance.
* @return A number starting at 0 for the first action
* @see #state
* @see #currentLabel
*/
public function get currentIndex():Number { return this._nIndex; }
/**
* Retrieves the currently playing action's label, if defined.
* @description { label:"introFade", start_alpha:0, start_brightOffset:100, time:1.5, ease:"easeInExpo" }* @return A string set in the action object using the label property. * @see #actionscript_video_com_mosesSupposes_fuse_Fuse * @see #label * @see #state * @see #currentIndex */ public function get currentLabel():String { return (actionscript_video_com_mosesSupposes_fuse_FuseItem(this[_nIndex]).getLabel()); } /** * see set target * @ignore */ public function get target():Object { return (_aDefaultTargs.length==1) ? _aDefaultTargs[0] : _aDefaultTargs; } /** * Instance default: Sets one or more animation targets that will be used for any actions that don't specify their own. * @description Overwrites prior existing targets. *
var f:actionscript_video_com_mosesSupposes_fuse_Fuse = new actionscript_video_com_mosesSupposes_fuse_Fuse(); * f.target = [clip1, clip2];* @param one target or an array of targets * @return a single animation target if one is set or an Array of targets if more than one is set. * @see #addTarget * @see #removeTarget * @see #getActiveTargets */ public function set target(t:Object):Void { delete _aDefaultTargs; if (t!=null) { addTarget(t); } } /** * Adds to current default target list. * @description
myactionscript_video_com_mosesSupposes_fuse_Fuse.addTarget(clip5);* @param accepts one or more targets, or an array of targets * @see #target * @see #removeTarget * @see #getActiveTargets */ public function addTarget(t:Object):Void { if (_aDefaultTargs==null) this._aDefaultTargs = []; if (arguments[0] instanceof Array) arguments = arguments[0]; for (var i:String in arguments) { var found:Boolean = false; for (var j:String in _aDefaultTargs) { if (arguments[i]==_aDefaultTargs[j]) { found = true; break; } } if (found==false) _aDefaultTargs.push(arguments[i]); } } /** * Removes targets from the current default target list. * @description
myactionscript_video_com_mosesSupposes_fuse_Fuse.removeTarget(clip5);* @param accepts one or more targets, or an array of targets * @see #target * @see #addTarget * @see #getActiveTargets */ public function removeTarget(t:Object):Void { if (_aDefaultTargs==null || _aDefaultTargs.length==0) return; if (arguments[0] instanceof Array) arguments = arguments[0]; for (var i:String in arguments) { for (var j:String in _aDefaultTargs) { if (arguments[i]==_aDefaultTargs[j]) _aDefaultTargs.splice(Number(j),1); } } } /** * Gets both the default target list and any targets in the action currently being played. * @param includeDefaults If true is passed, list includes the actionscript_video_com_mosesSupposes_fuse_Fuse instance's default target list plus active action targets. * @return Array of targets currently being handled by the playing or paused action, plus the actionscript_video_com_mosesSupposes_fuse_Fuse instance's default target list if true was passed.
start_x
in all or specific items.
* @description In this example a sequence is set up and all start props are set, although the actionscript_video_com_mosesSupposes_fuse_Fuse may not be used until later.
* var f:actionscript_video_com_mosesSupposes_fuse_Fuse = new actionscript_video_com_mosesSupposes_fuse_Fuse(); * f.target = clip1; * f.push({ start_alpha:0 }); // fade up * f.push({ x:'100', start_scale:150}); // scale down and slide * f.setStartProps();* If you want to set start props as the actionscript_video_com_mosesSupposes_fuse_Fuse is started, you can pass
setStartProps
parameters to {@link #start}.
* @param nothing/null/{@link com.mosesSupposes.fuse.actionscript_video_com_mosesSupposes_fuse_FuseKitCommon#ALL} to set all start props in the actionscript_video_com_mosesSupposes_fuse_Fuse.
* To specify some actions while excluding others, pass an array of item indices/labels or a series of indices/labels as separate parameters.
* @see #start
*/
public function setStartProps(trueOrItemIDs:Object):Void
{
var all:Boolean = (arguments.length==0 || trueOrItemIDs===true || trueOrItemIDs==actionscript_video_com_mosesSupposes_fuse_FuseKitCommon.ALL);
dispatchEvent({target:this,
type:'evtSetStart',
all:all,
filter:(trueOrItemIDs instanceof Array) ? trueOrItemIDs : arguments,
curIndex:((state=='playing') ? _nIndex : -1),
targs:_aDefaultTargs,
scope:scope});
}
/**
* Play-control: Begins sequence play at index 0, with option to set start props prior to play.
* @description In this example all start props are set during start by passing true.
* var f:actionscript_video_com_mosesSupposes_fuse_Fuse = new actionscript_video_com_mosesSupposes_fuse_Fuse(); * f.target = clip1; * f.push({ start_alpha:0 }); // fade up * f.push({ x:'100', start_scale:150}); // scale down and slide * f.start(true);* @param setStart A {@link #setStartProps} call is generated from all arguments before the actionscript_video_com_mosesSupposes_fuse_Fuse begins playing. * @see #stop * @see #pause * @see #resume * @see #skipTo */ public function start(setStart:Object):Void { close(); this.stop(true); this._sState = 'playing'; if (length==0) { advance(false,true); // fires onComplete, state must be playing } if (setStart!=null && setStart!=false){ setStartProps.apply(this,arguments); } dispatchEvent({target:this, type:'onStart'}); if (OUTPUT_LEVEL>1) actionscript_video_com_mosesSupposes_fuse_FuseKitCommon.output('-actionscript_video_com_mosesSupposes_fuse_Fuse#'+String(_nID)+' start.'); playCurrentItem(); } /** * Play-control: Stops a playing or paused actionscript_video_com_mosesSupposes_fuse_Fuse instance and resets the play-index to 0. * @see #start * @see #pause * @see #resume * @see #skipTo */ public function stop():Void { if(_sState!='stopped') { for (var i:Number=0; i
var f:actionscript_video_com_mosesSupposes_fuse_Fuse = new actionscript_video_com_mosesSupposes_fuse_Fuse(); * f.target = clip1; * f.push({ start_alpha:0 }); * f.push({ x:'100', label:"slideRight"}); * //later... * f.skipTo("slideRight"); // same as f.skipTo(1);* @param indexOrLabel numerical item index or label string. Pass a negative index to count back from end, like -1 for last item. * @see #start * @see #stop * @see #pause * @see #resume */ public function skipTo(indexOrLabel:Object):Void { close(); var index:Number; // label if (typeof indexOrLabel=='string') { index = -1; for (var i:Number=0; i
onComplete
event gets fired.
*/
private function advance(wasTriggered:Boolean, silentStop:Boolean):Void
{
var isLastFinal:Boolean = false;
if (_nIndex==length-1) {
for (var i:Number=length-1; i>-1; i--) {
if (actionscript_video_com_mosesSupposes_fuse_FuseItem(this[i])._nPlaying>-1) {
return; // an overlapping item (one containing a trigger) is not finished playing.
}
}
isLastFinal = true;
}
if (wasTriggered==true && isLastFinal==false) { // wasTriggered calls are sent only for the above check.
return;
}
if ((this[_nIndex]) instanceof actionscript_video_com_mosesSupposes_fuse_Fuse) {
actionscript_video_com_mosesSupposes_fuse_Fuse(this[_nIndex]).removeEventListener('onComplete', _oDel1);
}
if (++_nIndex>=length) {
this.stop(silentStop);
if (actionscript_video_com_mosesSupposes_fuse_Fuse.OUTPUT_LEVEL>1) actionscript_video_com_mosesSupposes_fuse_FuseKitCommon.output('-actionscript_video_com_mosesSupposes_fuse_Fuse#'+String(_nID)+' complete.');
dispatchEvent({target:this, type:'onComplete'});
if (autoClear==true || (autoClear!==false && AUTOCLEAR==true)) destroy();
return;
}
if (actionscript_video_com_mosesSupposes_fuse_Fuse.OUTPUT_LEVEL>1) actionscript_video_com_mosesSupposes_fuse_FuseKitCommon.output('-actionscript_video_com_mosesSupposes_fuse_Fuse#'+String(_nID) + ' advance: '+_nIndex);
dispatchEvent({target:this, type:'onAdvance'});
playCurrentItem();
}
/**
* Internal helper that triggers startItem()
in currently active item.
* @param postDelay true is sent when a delay has completed.
*/
private function playCurrentItem(postDelay:Boolean):Void
{
clearInterval(_nDelay);
if (postDelay!==true) {
var d:Number = (actionscript_video_com_mosesSupposes_fuse_FuseItem(this[_nIndex]).evalDelay(scope) || 0);
//if (_nIndex==0 && d==0) d = .01;// super-tiny delay at actionscript_video_com_mosesSupposes_fuse_Fuse start fixes a number of glitches.
if (d>0) {
this._nTimeCache = getTimer()+(d*1000);//used during pause.
this._nDelay = setInterval(Delegate.create(this, playCurrentItem), d*1000, true);
return;
}
}
_nTimeCache = _nDelay = -1;
if ((this[_nIndex]) instanceof actionscript_video_com_mosesSupposes_fuse_Fuse) {
if (_oDel1==null) _oDel1 = Delegate.create(this,advance);
actionscript_video_com_mosesSupposes_fuse_Fuse(this[_nIndex]).addEventListener('onComplete', _oDel1);
}
var propsTweened:String = (actionscript_video_com_mosesSupposes_fuse_FuseItem(this[_nIndex]).startItem(_aDefaultTargs, scope));
if (actionscript_video_com_mosesSupposes_fuse_Fuse.OUTPUT_LEVEL>1) actionscript_video_com_mosesSupposes_fuse_FuseKitCommon.output('-actionscript_video_com_mosesSupposes_fuse_Fuse#'+String(_nID)+' props tweened: '+propsTweened);
}
/**
* Internal event used when the fuse is nested in a parent fuse. (Polymorphism - this is a actionscript_video_com_mosesSupposes_fuse_FuseItem method that only appears in actionscript_video_com_mosesSupposes_fuse_Fuse for the nested instance case).
*/
private function evtSetStart(o:Object):Void
{
setStartProps.apply(this, o.filter);
}
/**
* actionscript_video_com_mosesSupposes_fuse_FuseItem method used by a actionscript_video_com_mosesSupposes_fuse_Fuse only when the it is nested in a parent actionscript_video_com_mosesSupposes_fuse_Fuse.
* @param targs
* @param scope
*/
public function startItem(targs:Array, scope:Object):Void
{
// adopt scope and targs from parent if none set. This is really rough,
// ultimately it ought to be written to cache the original values then restore.
if (target==null) target = targs;
if (scope==null) scope = scope;
this.start();
}
/**
* Simple Syntax: Generate a new actionscript_video_com_mosesSupposes_fuse_Fuse and begin intercepting tween calls until {@link com.mosesSupposes.fuse.actionscript_video_com_mosesSupposes_fuse_Fuse#close} is called.
* @description Simple Syntax is an alternative way to construct actionscript_video_com_mosesSupposes_fuse_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 * actionscript_video_com_mosesSupposes_fuse_Fuse.open(); * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand (mainMenu, "draw", menuXML); * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand ("delay", .5); * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand (contentPage, "loadContent", firstItem); * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand (screenDisplay, "exposeLayout"); * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand ("delay", 2); * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand (this, "onResize"); * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand (Logger, "output", "Setup sequence complete.", 0); * actionscript_video_com_mosesSupposes_fuse_Fuse.close(); * * // Example 2: Simple Syntax with shortcut tweens * actionscript_video_com_mosesSupposes_fuse_Fuse.open(); * box_mc.slideTo(150,150, 1); * actionscript_video_com_mosesSupposes_fuse_Fuse.openGroup(); * box_mc.scaleTo(250, 1); * box_mc.brightnessTo(-50, 2); * actionscript_video_com_mosesSupposes_fuse_Fuse.closeGroup(); * box_mc.colorTo(0x6633FF, 1); * actionscript_video_com_mosesSupposes_fuse_Fuse.closeAndStart(); **
var f:actionscript_video_com_mosesSupposes_fuse_Fuse = actionscript_video_com_mosesSupposes_fuse_Fuse.open(); // store a reference to the actionscript_video_com_mosesSupposes_fuse_Fuse * // later... * actionscript_video_com_mosesSupposes_fuse_Fuse.open(f); // reopen existing * // or... * actionscript_video_com_mosesSupposes_fuse_Fuse.open(0); // open actionscript_video_com_mosesSupposes_fuse_Fuse with id 0 * // or... * actionscript_video_com_mosesSupposes_fuse_Fuse.open("introSequence"); // open actionscript_video_com_mosesSupposes_fuse_Fuse with the label "introSequence"*
actionscript_video_com_mosesSupposes_fuse_Fuse.openGroup()
can be called in place of actionscript_video_com_mosesSupposes_fuse_Fuse.open()
.actionscript_video_com_mosesSupposes_fuse_Fuse.openGroup()
is called while a previous group was open, the preceding group is closed automatically.
* // use in place of actionscript_video_com_mosesSupposes_fuse_Fuse.open() to begin a new actionscript_video_com_mosesSupposes_fuse_Fuse. * actionscript_video_com_mosesSupposes_fuse_Fuse.openGroup(); * clip1.tween("_x","100"); * clip2.tween("_scale",200); * actionscript_video_com_mosesSupposes_fuse_Fuse.openGroup(); // you can skip closeGroup if opening another group. * clip1.tween("_x","-100"); * clip2.tween("_scale",100); * actionscript_video_com_mosesSupposes_fuse_Fuse.closeAndStart(); // you can skip closeGroup here too. ** @param fuseOrID:actionscript_video_com_mosesSupposes_fuse_Fuse (Optional) an existing actionscript_video_com_mosesSupposes_fuse_Fuse or actionscript_video_com_mosesSupposes_fuse_Fuse's id or label in which to open the new group. * @return The currently open fuse instance or a new actionscript_video_com_mosesSupposes_fuse_Fuse if openGroup was called prior to open(). * @see #open * @see #closeGroup * @see #close * @see #closeAndStart * @see #startRecent * @see #addCommand * @see #id * @see #label */ public static function openGroup(fuseOrID:Object):actionscript_video_com_mosesSupposes_fuse_Fuse { // allow openGroup() to open a new sequence. if (!(_oBuildMode!=null && _oBuildMode.curID>-1)) open(fuseOrID); else if (_oBuildMode.curGroup!=null) closeGroup(); _oBuildMode.curGroup = new Array(); return getInstance(_oBuildMode.curID); } /** * Simple Syntax: Closes an action group started by {@link #openGroup}. * @description May be omitted if followed by
actionscript_video_com_mosesSupposes_fuse_Fuse.close
or actionscript_video_com_mosesSupposes_fuse_Fuse.closeAndStart
.actionscript_video_com_mosesSupposes_fuse_Fuse.openGroup()
is called while a previous group was open, the preceding group is closed automatically and the closeGroup
command can be skipped.
* actionscript_video_com_mosesSupposes_fuse_Fuse.open(); * clip1.tween("_x","100"); * actionscript_video_com_mosesSupposes_fuse_Fuse.openGroup(); * clip1.tween("_x","-100"); * clip2.tween("_scale",200); * actionscript_video_com_mosesSupposes_fuse_Fuse.closeGroup(); * clip1.scaleTo(0); * clip2.scaleTo(0); * actionscript_video_com_mosesSupposes_fuse_Fuse.closeAndStart();* @see #open * @see #openGroup * @see #close * @see #closeAndStart * @see #startRecent * @see #addCommand */ public static function closeGroup():Void { if (_oBuildMode.curGroup==null || !(_oBuildMode!=null && _oBuildMode.curID>-1)) return; getInstance(_oBuildMode.curID).push(_oBuildMode.curGroup); _oBuildMode.curGroup = null; } /** * Simple Syntax: Completes the actionscript_video_com_mosesSupposes_fuse_Fuse generated by {@link com.mosesSupposes.fuse.actionscript_video_com_mosesSupposes_fuse_Fuse#open}. * @description It is important that you complete each actionscript_video_com_mosesSupposes_fuse_Fuse created using
actionscript_video_com_mosesSupposes_fuse_Fuse.open()
using either actionscript_video_com_mosesSupposes_fuse_Fuse.close()
or actionscript_video_com_mosesSupposes_fuse_Fuse.closeAndStart()
. You cannot call start
on a actionscript_video_com_mosesSupposes_fuse_Fuse instance while actionscript_video_com_mosesSupposes_fuse_Fuse is open.
* var runSetup:actionscript_video_com_mosesSupposes_fuse_Fuse = actionscript_video_com_mosesSupposes_fuse_Fuse.open(); * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand(this, "callbackOne"); * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand("delay", .25); * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand(this, "callbackTwo"); * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand("delay", .25); * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand(this, "callbackThree"); * actionscript_video_com_mosesSupposes_fuse_Fuse.close(); * * // later in program... * runSetup.start(); // reference the actionscript_video_com_mosesSupposes_fuse_Fuse created ** @see #open * @see #openGroup * @see #closeGroup * @see #closeAndStart * @see #startRecent * @see #addCommand */ public static function close():Void { if (!(_oBuildMode!=null && _oBuildMode.curID>-1)) return; if (_oBuildMode.curGroup!=null) closeGroup(); _oBuildMode.curID = -1; } /** * Simple Syntax: Close the open actionscript_video_com_mosesSupposes_fuse_Fuse instance and start it playing. * @description
var runSetup:actionscript_video_com_mosesSupposes_fuse_Fuse = actionscript_video_com_mosesSupposes_fuse_Fuse.open(); * clip1.fadeOut(); * clip2.fadeOut(); * clip3.fadeOut(); * actionscript_video_com_mosesSupposes_fuse_Fuse.closeAndStart();* @param setStart A {@link #setStartProps} call is generated from all arguments before the actionscript_video_com_mosesSupposes_fuse_Fuse begins playing. * @see #open * @see #openGroup * @see #closeGroup * @see #close * @see #startRecent * @see #addCommand */ public static function closeAndStart(setStart:Object):Void { if (!(_oBuildMode!=null && _oBuildMode.curID>-1)) return; var f:actionscript_video_com_mosesSupposes_fuse_Fuse = getInstance(_oBuildMode.curID); close(); f.start.apply(f, arguments); } /** * Simple Syntax: Restarts the actionscript_video_com_mosesSupposes_fuse_Fuse most recently created using actionscript_video_com_mosesSupposes_fuse_Fuse.{@link #open}(). * @param setStart A {@link #setStartProps} call is generated from all arguments before the actionscript_video_com_mosesSupposes_fuse_Fuse begins playing. * @see #open * @see #openGroup * @see #closeGroup * @see #close * @see #closeAndStart * @see #addCommand */ public static function startRecent(setStart:Object):Void { var f:actionscript_video_com_mosesSupposes_fuse_Fuse = getInstance(_oBuildMode.prevID); if (f!=null) f.start.apply(f, arguments); else actionscript_video_com_mosesSupposes_fuse_FuseKitCommon.error('108'); } /** * Simple Syntax: Multi-purpose method to add an inline actionscript_video_com_mosesSupposes_fuse_Fuse command, delay, or function-call to the open actionscript_video_com_mosesSupposes_fuse_Fuse. * @description
var f:actionscript_video_com_mosesSupposes_fuse_Fuse = new actionscript_video_com_mosesSupposes_fuse_Fuse(); * * // callback: scope, func, args * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand(this, "setItemData", 0, "Submit", true); * * // delay * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand("delay", .5); * * // inline actionscript_video_com_mosesSupposes_fuse_Fuse play-command: forces actionscript_video_com_mosesSupposes_fuse_Fuse to loop by restarting * actionscript_video_com_mosesSupposes_fuse_Fuse.addCommand("start"); * * actionscript_video_com_mosesSupposes_fuse_Fuse.closeAndStart(); ** @param commandOrScope may be:
'delay','start','stop','pause','resume','skipTo','setStartProps'
or in the case of a function-call a scope such as this
.
* @param indexOrFunc 'delay'
:number of seconds. 'skipTo'
:destination index/label. For function-call, a string of the function name such as 'trace'
* @param argument for function-call, any number of arguments can follow and will be passed to the function when it's called.
* @see #open
* @see #openGroup
* @see #closeGroup
* @see #close
* @see #closeAndStart
* @see #startRecent
*/
public static function addCommand(commandOrScope:Object, indexOrFunc:Object, argument:Object):Void
{
if (!(_oBuildMode!=null && _oBuildMode.curID>-1)) return;
var into:Array = (_oBuildMode.curGroup!=null) ? _oBuildMode.curGroup : getInstance(_oBuildMode.curID); // New feature: allow addCommand within groups
if (typeof commandOrScope=='string') { // assume it's a command
if (_oBuildMode.curGroup!=null && commandOrScope!='delay') {
actionscript_video_com_mosesSupposes_fuse_FuseKitCommon.error('109',String(commandOrScope));
return;
}
var validCommands:String = '|delay|start|stop|pause|resume|skipTo|setStartProps|'; // "delay" command is specific to simple syntax
if (validCommands.indexOf('|'+commandOrScope+'|')==-1 || ((commandOrScope=='skipTo' || commandOrScope=='delay') && indexOrFunc==undefined)) {
if (OUTPUT_LEVEL>0) actionscript_video_com_mosesSupposes_fuse_FuseKitCommon.error('110',String(commandOrScope));
}
else {
into.push({__buildMode:true, command:commandOrScope, commandargs:indexOrFunc});
}
}
else {
// assume it's a function-call
into.push({__buildMode:true, scope:commandOrScope, func:indexOrFunc, args:arguments.slice(2)});
}
}
// -- internal --
/**
* @exclude
* Internal use only. This is the method ZigoEngine uses to route tween calls into an open actionscript_video_com_mosesSupposes_fuse_Fuse instance after actionscript_video_com_mosesSupposes_fuse_Fuse.open()
.
* @return true if actionscript_video_com_mosesSupposes_fuse_Fuse is in build-mode
*/
public static function addBuildItem(args:Array):Boolean
{
if (!(_oBuildMode!=null && _oBuildMode.curID>-1)) return false;
var into:Array = (_oBuildMode.curGroup!=null) ? _oBuildMode.curGroup : getInstance(_oBuildMode.curID);
if (args.length==1 && typeof args[0]=='object') {
// Object syntax can be mixed with simple syntax by using actionscript_video_com_mosesSupposes_fuse_Fuse.open(); with commands like my_mc.tween({x:'100'});
into.push(args[0]);
}
else {
into.push({__buildMode:true, tweenargs:args});
}
return true;
}
/**
* Internal, used to add a actionscript_video_com_mosesSupposes_fuse_Fuse instance to the _aInstances array.
* @param actionscript_video_com_mosesSupposes_fuse_Fuse instance
* @return internal index used as actionscript_video_com_mosesSupposes_fuse_Fuse's id
*/
private static function registerInstance(s:actionscript_video_com_mosesSupposes_fuse_Fuse):Number
{
if(_aInstances==null) _aInstances = new Array();
return _aInstances.push(s)-1;
}
/**
* Interal, used to remove a actionscript_video_com_mosesSupposes_fuse_Fuse instance from the _aInstances array.
* @param id
* @param isDestroyCall
*/
private static function removeInstanceAt(id:Number, isDestroyCall:Boolean):Void
{
if (isDestroyCall!=true) {
actionscript_video_com_mosesSupposes_fuse_Fuse(_aInstances[id]).destroy();
}
delete _aInstances[id];
}}