import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;

function stopAll(content:DisplayObjectContainer):void
if (content is MovieClip)
(content as MovieClip).stop();

if (content.numChildren)
var child:DisplayObjectContainer;
for (var i:int, n:int = content.numChildren; i < n; ++i)
if (content.getChildAt(i) is DisplayObjectContainer)
child = content.getChildAt(i) as DisplayObjectContainer;

if (child.numChildren)
else if (child is MovieClip)
(child as MovieClip).stop();

TimelineMax extends TimelineLite, offering exactly the same functionality plus useful (but non-essential) features like
(and probably more in the future). It is the ultimate sequencing tool that acts like a container for tweens and other timelines, making it simple to control them as a whole and precisely manage their timing.

Its easy to make complex sequences repeat with TimelineMax and there are plenty of methods and events that give you complete access to all aspects of your animation as shown in the demo below.


Interesting note: The animation in the banner above is a mere 11 lines of TimelineMax code.

The next demo illustrates many of the things TimelineLite and TimelineMax handle with ease, such as the ability to:

  • insert multiple tweens with overlapping start times into a timeline
  • create randomized bezier tweens
  • control the entire set of tweens with a basic UI slider
  • repeat the animation any number of times
  • dynamically adjust the speed at runtime. Notice how the play / pause buttons smoothly accelerate and deccelerate?

*Warning: Do not attempt to create the animation above with CSS3 Animations or any other JavaScript library.

Be sure to check out TimelineLite for more info on all the capabilities TimelineMax inherits. The chart below gives a birds-eye look at the methods these tools provide.

TimelineLite and TimelineMax Methods

  • add()
  • addLabel()
  • addPause()
  • call()
  • clear()
  • delay()
  • duration()
  • eventCallback
  • exportRoot()
  • from()
  • fromTo()
  • getChildren()
  • getLabelTime()
  • getTweensOf()
  • invalidate()
  • isActive()
  • kill()
  • pause()
  • paused()
  • play()
  • progress()
  • remove()
  • removeLabel()
  • render()
  • restart()
  • resume()
  • reverse()
  • reversed()
  • seek()
  • set()
  • shiftChildren()
  • staggerFrom()
  • staggerFromTo()
  • staggerTo()
  • startTime()
  • time()
  • timeScale()
  • to()
  • totalDuration()
  • totalProgress()
  • totalTime()
  • useFrames()

import flash.display.Shape;
import flash.display.GradientType;
import flash.geom.Matrix;

var type:String = GradientType.RADIAL;
var colors:Array = [0x00FF00, 0x000088];
var alphas:Array = [1, 1];
var ratios:Array = [0, 255];
var spreadMethod:String = SpreadMethod.PAD;
var interp:String = InterpolationMethod.LINEAR_RGB;
var focalPtRatio:Number = 0;

var matrix:Matrix = new Matrix();
var boxWidth:Number = 50;
var boxHeight:Number = 100;
var boxRotation:Number = Math.PI/2; // 90°
var tx:Number = 25;
var ty:Number = 0;
matrix.createGradientBox(boxWidth, boxHeight, boxRotation, tx, ty);

var square:Shape = new Shape;,
focalPtRatio);, 0, 100, 100);