Fuse FAQ
Answers to frequently asked questions about the Fuse Kit 2 (ActionScript 2.0).
Just starting out? Be sure you also read the "primer in plain English" and watch the Fuse video tutorials
from gotoAndLearn. These and other resources are listed on the home page.
General
± I'm having trouble after installing a new version of Fuse,
the update did not seem to take effect.
Run the following trace after your setup to find out what version of Fuse is actually publishing:
trace(FuseKitCommon.VERSION);
If it shows a previous version in the output window, you need to do two things.
- Most important is to clear
your ASO cache. There is a great extension offered by Adobe that adds a "delete ASO files and
test movie" option to Flash's Control menu, just under Test Movie.
(You can also manually delete
the aso directory in the Flash configuration directory under your user profile.)
- If that doesn't fix the problem it means that Flash is finding an outdated version of Fuse in one of its
available classpaths. For instance you may have forgotten to uninstall an older version of
the Fuse Kit Extension, or you may have a classpath set in your Flash or the FLA's AS2.0 preferences
pointing to a classes directory that contains an older version.
The most failsafe setup is to put the com.mosesSupposes directory next to your FLA and be sure your Flash
preferences have "./" at the top of the list, which targets the local directory.
Another possible source of trouble is that Fuse behavior has changed slightly in recent versions (see the Updating page in the documentation).
± Why are there so many syntaxes in the Fuse Kit?
The Fuse Kit is flexible and versatile. But don't be intimidated, it's also designed for comfort.
If you're a beginner, all you need to learn is how to use tweening shortcuts like alphaTo. Get fancy later
— daisy-chain a few tweens with open and close. (Yeah, it's called Simple Syntax for a reason.)
Advanced coders can choose to use shortcut tweens or the static ZigoEngine.doTween method, and
should use Fuse's Object Syntax for sequencing.
When to use which? For the fastest performance, and for single tweens like rollovers,
use tween calls. Save Fuse for more complex jobs.
More info: read Getting Started in the documentation.
± How fast is ZigoEngine and how can I make it run even
faster?
It is one of the best-performing
AS2 tween engines available. Expanding on concepts in the earlier work of Ladislav Zigo, it's
specifically designed to combat AS2's limitations. It can initialize huge numbers of tween
calls at once without crashing the SWF, and process hundreds of properties at a time with
little noticeable lag.
The Fuse sequencer utility, however, is not designed for such
"extreme" performance, it is instead geared for complex runtime functionality.
So when speed matters, use only the ZigoEngine.
Floating frame-rate:
The engine accepts durations in seconds — which is most intuitive —
but updates itself on a frame-based pulse for smoothest rendering. This killer combination
ensures that tweens will run "on time" even as the player frame
rate fluctuates per user's system. Use a higher frame rate (30 or 40
FPS) for smoother tweens on faster systems, since times will remain consistent across
machines.
Optimization tips:
- Adding listeners to your targets slows the engine significantly. Use built-in callbacks instead whenever you can.
- Keep it simple. Color transforms, beziers, and complex easings like elastic and back hit the processor harder.
Be creative: Often an animation can be very quick, or very subtle, and have the same visual impact as an elaborate
processor-intensive effect.
- Block your own groups. The engine processes every property individually on ever target (to provide granular
control). Using an updfunc callback from one tween, you can set
multiple properties on multiple targets, thus lightening the engine's load. Nest clips that animate together
in a shared holder-clip that can be manipulated as a block.
- Understand the difference between engine lag and render lag. If you're running less than a hundred properties
in the engine at once, chances are it's keeping up just fine. No engine can redeem a poorly
optimized project. Problem areas include animating text blocks, alpha-blending large areas,
over-use of vector art, masks, or just tweening too much at once.
Custom Animation Loops
No tween engine or pre-packaged solution can approach the speed of a simple custom-written code loop.
Weigh the benefits of the engine's many conveniences. For games or other intensive visuals, you can
streamline by customizing some parts of your code, then fall back on the engine for basics.
± code example: single-tween loop
This tween loop uses the same potent combination of time-based duration and frames-based updating mentioned above.
By itself it's measurably more efficient than any tween engine. Still, ZigoEngine retains some very practical advantages,
like centralization of all tweens SWF-wide.
± After I loaded an image, shortcut tweens like alphaTo no longer work.
This is a Flash issue.
Loading images often "knocks out" MovieClip methods, including tweening shortcuts.
The solution is simple: Always load images into an additional sub-clip, then leave that clip
alone and manipulate the image using the holder clip.
± code example
Copy and paste this example into an FLA set to around 30 fps and Test Movie.
Advanced
± Setting "_listeners" to null or a new Array in a tween
target breaks tweening.
_listeners is a protected member used for event dispatching. Do not use that variable name.
± I extended Array.prototype and it broke Fuse.
This is a Flash issue.
Fuse subclasses the Array class using the extends keyword.
In general it's best to choose either subclassing or prototype modification, whereas mixing the two can sometimes cause conflicts.
In practice, extending the Array class is fairly complex and not appropriate unless you're building
a serious list-based utility like a HashMap.
A far easier tactic is to create a simple
helper class. By adding methods to your helper classes as you need them, you'll build
your own utility library of things you really use.
± example of a helper class
Call ArrayHelpers.shuffle(myArray); to
randomly sort the contents of myArray. You can save this class as a starter, then continue to add your own Array helpers
as they come up in your work.
± example of a class that extends Array. Again, not recommended for basic tasks.
± How can I customize and extend the functionality of ZigoEngine
and Fuse?
The ZigoEngine does not use an extensible architecture, but it is quite easy to add functionality to it.
This is most easily done using an onTweenUpdate event or updfunc callback. That code can be packaged
into a small utility class that automates the process further with a tweened getter/setter
property. For example if you extend the Sound class to add a volume getter/setter, you can
tween volume on an instance of that class, which is a very simple and clean solution.
The new FuseFX utility from MosesSupposes makes it easy to add your own custom tweens.
The download now includes several examples of extending the engine using FuseFX and not using
it. More»
If you want to write your own custom updaters, here are some features of the kit you should know about:
- Tween custom variables. This is a powerful, simple feature — as long as the variable has been declared and set to
a number it can be tweened in any target Object (not just MovieClips).
ZigoEngine.doTween(this, "z", "200", 1);
If that variable is a setter in a custom class instance, you don't even need an update callback
since your setter function will be fired every time the engine udpates the variable.
- Multi-tween functionality. This is another underused but very powerful feature of ZigoEngine that can really help
you tie it into complex situations.
For example if you're tracking a 3D vector object, you can pass a similar object as an end-value:
ZigoEngine.doTween(this, "vectorA", {x:"100",
y:"100", z:"-100"}, 1, "easeOutElastic");
You can also use that feature to tween Arrays, and even Arrays of color values.
- Update events are key (updfunc callbacks or onTweenUpdate events). Tween any variable from 0-1 or
from 0-100, and you've created a multiplier that can be applied to any number of further updates.
- A special "onTweenAdd" event was recently added to ZigoEngine (Fuse Kit 2.1.3) to make it even easier
to author extensions.
The event is dispatched after doTween has parsed and validated
all user inputs, and just before the tweens are added to the internal ZManager instance.
This is ideal in that your extension can know exactly what tweens are about to run
in the engine, no matter where they are being added from in your SWF's code. (Note
on
props: _scale & _size are split into movieclip properties, and duplicate properties are stripped, with the exception
of overlapping _fade / _alpha and overlapping color-transform tweens.)
|