1. Home
  2. Computing & Technology
  3. Animation

Dynamic Animation in Flash: Moving Dynamically Drawn Shapes

By Adrien-Luc Sanders, About.com

4 of 7

We’re going to start off with the basic code to draw a shape:
onClipEvent (load) {
_root.createEmptyMovieClip (“box”, 1);
_root.box.linestyle (2, 0xAAAAFF, 100);
_root.box.moveTo (100,100);
_root.box.lineTo (200,100);
_root.box.lineTo (200,200);
_root.box.lineTo (100,200);
_root.box.lineTo (100,100); }

When the movie clip initially loads, this creates an empty movie clip at depth 1 on the root level with the instance name box. It then draws an unfilled square with stroke thickness 2, opacity 100%, and color light blue, at 100x100 pixels and centered on the stage. (You should be familiar with the Flash drawing API for this.)

Explore Animation
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Dynamic Animation in Flash: Moving Dynamically Drawn Shapes

©2009 About.com, a part of The New York Times Company.

All rights reserved.