August 31, 2004

AnimationPackage 1.02 released

alex uhlmann has released a new version of animation package, a library of classes for drawing and animating content procedurally.

>> get AnimationPackage here

here's the impressive list of updates:

Sequence.setAnimateMode() and Sequence.setEasingMode() allows to treat child animations as a whole. It allocates the start/end percentage values and/or the easing equation along the whole Sequence. Usefull for animating motion paths via Move, MoveOnQuadCurve and MoveOnCubicCurve.

Sequence.getChild, Sequence.getChildDuration.

MoveOnPath allows to animate an object evenly along a path using Ivan Dembicki's com.sharedfonts.Path. This class emulates motion path tweening from the Flash IDE.

The Animation class combines Sequence and Parallel to allow overlaps of child animations.

Animation classes offer opportunities to set the starting value(s) and end value(s) either via the new setStartValue, setStartValues, setEndValue, setEndValues methods, the run method or the constructor.

Timeline allows to animate existing movieclip timelines.



The MoveOnCurve class animates an object along a bezier curve with n control points. Usefull for long paths.

The Curve class draws a bezier curve with n control points.

Move.orientToPath and MoveOnQuadCurve.orientToPath can rotate the object towards the line/curve while animating.

QuadCurve, CubicCurve, MoveOnQuadCurve and MoveOnCubicCurve offer ways to specify control points between the start and end points of the curve instead of points on the curve. (useControlPoints method or via parameters)

Volume allows to fade sounds with easing equations.

SingleAnimator allows to animate a single property or method in a more intuitve way than via Animator.

Animator has stop, pause and resume methods.

Trail can attach a trail for infinite length and can remove it explicitly. And it's faster.

Almost all classes that use animations increased in performance because of a faster Animator class.

All classes offer a getID method that returns a unique identifier of the instance. Useful for associative arrays.

All drawing classes offer a clear method to remove all drawings drawn from the instance.

Revised documentation.

Posted by moock at 12:09 PM

August 22, 2004

flashinthecan: 4 city tour

shawn pucknell, founder of flash in the can, is taking a miniature version of the conference on the road to four cities in canada over 6 days. each city gets a single day with a single track of presentations. looks like a solid little event with some excellent speakers. and it's a bargain at only $160 (early bird price) or $75 for students (again, early bird price).

if you live anywhere near montreal definitely don't miss this rare chance to see james patterson and amit pitaru present. likewise, torontonians: don't miss jared tarbell live for only the second time in his career.

lots more info here:

and here's the speaker list:
Jared Tarbell //
Brian Donovan //
Shaun Hamontree & Ben Radatz //
Tony MacDonell //
Joshua Davis //
Erik Natzke //
Steve Ozipko & Brian Robbins //
Grant Skinner //
Yohan Gingras // *
Vincent Ramsay-Lemelin // *
James Paterson // /
Amit Pitaru //
Robert Reinhardt // Schematic / [theMAKERS]
Brooke Burgess //
Jessey White-Cinis //
Thomas Brodahl // /
Rob McLaughlin //
Kevin Airgid //
Shane Mielke // /

Posted by moock at 11:11 PM

August 20, 2004

EventProxy vs mx.utils.Delegate

earlier this year, mike chambers wrote about an EventProxy class for v2 component event handling (see mike's blog post). i mentioned the EventProxy class in essential actionscript 2.0, chapter 12. i also offered a slightly improved version that included more type checking.

since then, macromedia has released the ellipsis update (flash authoring version 7.2). ellipsis includes a new class, mx.utils.Delegate, which replaces EventProxy. so, what's the difference between the two classes?

there are two differences between my updated EventProxy class and the Delegate class: 1) function return value and 2) listeners for actionscript's built-in classes.

1) function return value

when the Delegate class invokes the specified event-handling function, it returns the return value of that function back to the caller (the caller is the component broadcasting the event). however, the EventDispatcher class used by v2 components to broadcast events does not use, nor store the return value of the methods it invokes at event time, so this difference is largely academic.

traditionally, event broadcasting classes do not use the return values of the event methods they invoke, so it is unlikely that EventDispatcher will ever store or use the return values of the event methods it invokes. however, in the unlikely case that EventDispatcher is revised to use the return value of the event methods it invokes, then the Delegate class will be required in favour of EventProxy.

i assume macromedia chose to implement return-value preservation in Delegate as a matter of good form, not out of necessity. by passing the event-method's return value back to the caller, the Delegate class laudably emulates the behaviour of a direct method call, whereas EventProxy does not.

2) listeners for actionscript's built-in classes*

the mx.utils.Delegate class returns a function, not an object, so it can be used to listen to events from actionscript's built-in classes such as MovieClip and XML. in other words, Delegate effectively lets you use listener objects with traditional "function handler"-style actionscript events. for example, using Delegate you can do this:

var obj:SomeClass = new SomeClass();
someMovieClip.onEnterFrame = 
    mx.utils.Delegate.create(obj, obj.someMethod);

given these improvements, and considering that Delegate is now shipped as an official class with Flash MX 2004, you should, in future, use Delegate rather than EventProxy to map component events to arbitrary object method calls. that said, there is currently no practical negative consequence to using EventProxy instead of Delegate, and legacy code need not be updated at this time.

* thanks to p. simek for pointing out this very important and useful feature of mx.utils.Delegate.

Posted by moock at 03:18 PM