impression logo

Impression Learning Content Framework

Support Article
Last modified: 23 November 2012

Creating Animations

This appendix proivdes additional information about creating animations for use with the impression.players.SWFVideo (AS3) and Impression.Players.Video (AS2) classes.

Creating Non-Stepped Animations

To create a traditional animation, simply build your animation as you would normally.  Note that only .SWF files are supported.

Creating Stepped Animations

To create a stepped animation, begin by adding the number of total steps of the animation as frames on the root timeline of the clip. This top-level clip is called the base clip. For each step animation, add one MovieClip object to each frame of the base clip (called the step clip). There are no special naming requirements.

CAUTION:

When looking for the step clip to play, the player object finds the last object of type MovieClip on the current frame and invokes methods (e.g., play, gotoAndPlay, gotoAndStop) on that clip. Placing more than one MovieClip on each frame can result in unexpected behavior.

NOTE:

Logicdriven provides a Stepped Animation Viewer that you can use to validate your AS2 or AS3 stepped animations.

OnEnterFrame

To provide its functionality, the player object will override either the base clip's (for a non-stepped animation) or the step clip's onEnterFrame event. 

In the AS2 Video player class, the clip's existing onEnterFrame function is replaced by code in the Video player.  You can use the useStepOnEnterFrame property of the VideoFormat object to specify whether or not the original code is executed.  When the clip is unloaded (or a new step clip is activated), the original code is restored.

CAUTION:

When a clip is active in the AS2 Video player, the onEnterFrame event code should not be programmatically manipulated.  Unexpected behavior may result.

In the AS3 SWFVideo player class, the player object uses addEventListener to process actions during the onEnterFrame event, which means that your existing code will always execute.  If you do not want this behavior, create a public player property getter/setter pair of functions on the root of your animation, and add code to the setter function that changes your animation's behavior.

Before the player object performs its work, it (normally) automatically invokes the original onEnterFrame event. In most cases, this should not present problems for the animator. While the clip is under the control of the Video object, the onEnterFrame event should not be programmatically manipulated because unexpected behavior may result.

Video Object Control

It is possible to programmatically manipulate the player class instance from an animation.

In the AS2 Video player class, two properties are added to the base clip when the animation is loaded into the player. The first, videoPlayer, is a reference to the Video player class instance. The second, sb, is a reference to the current storyboard.  In the AS3 SWFVideo player class, only one property is added, player, which is a reference to the SWFVideo player class instance.

WARNING:

Do NOT directly manipulate the SWF file to perform controller functions, instead, use the methods on the Video player class instance.  If you directly manipulate the SWF file, unexpected results may occur.


CAUTION:

As part of the monitoring process, the AS2 Video object will also add the videoPlayer and sb properties to the currently playing (or paused) step clip. These references are necessary for Video player object functionality. Animators should not rely on these properties being present, as they may be removed without warning. Only the base clip references should be used.

Detached Animations

It is possible to "detach" an animation from the player object by changing the value of the renderingSurface property. Changing the property value removes all references to external objects and (in AS2) restores the onEnterFrame code. Note that if the status of the clip was playingToEnd, playback continues. If the status property value was playingStep, playback continues but does not stop at the end of the current step; rather, playback stops at the end of the base clip.

If you wish to control the animation once it is detached, it is available in AS2 by accessing the baseClip MovieClip inside the old rendering surface. In AS3, the animation is inside the Loader object (actually, a LoaderEx object) which is the only child added to the rendering surface.