Object How-to

This document describes how to create object media in the flash authoring environment.

An object ( or character ) is defined as a list of Sprites, each Sprite representing the object in a given rotation. When the engine sets the rotation for any object, it will look for the Sprite representing an angle closest to the desired one. Therefore, the more sprites you create for an object, the smoother its rotation will be.

Each of these sprites are created as separate movieClips and given individual export names, which then will be placed inside the object’s definition XML. We’ll see that in another tutorial. Let’s go: create a new MovieClip.

Object sprites step 1 Place all frames of you animation in the timeline. Label your frames at will ( the engine provides methods to access them ). You can program loops in this timeline, using gotoAndPlays to program a walk loop for example.

Object sprites step 2

The 0,0 of the movieClip corresponds to the point where the object stands. For people, it means the position of their feet when they are standing on the floor. Look a the second image for an example.

You are ready to go. Now make this clip available from your XML definitions:

  1. Right-click this movieClip on the library, select export settings, choose an export name.
  2. Check “export in first frame”.
  3. Remember name.
  4. Publish.
  5. Use name as source for an sprite in your object definition XML.

Note: the engine assumes that all sprites for an object have the same number of frames representing the same animations. Why ? Imagine a character running. Its rotation has caused Sprite 0 to be used. This sprite is currently at frame 32 ( somewhere in your walk loop ). Now you change the object’s rotation to another, and a new Sprite is needed ( say Sprite 3 ). The engine stores 32 as current frame, removes Sprite 0 form the Stage, adds Sprite 3 and gotoAndPlays Sprite 3 to frame 32, assuming it will represent the same frame with another rotation.