This week we will look at manipulating bitmapdata for drawing at pixel level. In addition, we will cover some simple drag and drop interactivity as well as collision detection. When combined with the mouse and keyboard event listeners that we worked with before, we may start to conceive of putting together prototypes for games and interfaces.


Bitmap is a display object that represents a bitmap image. It may be added as a child to a DisplayObjectContainer just like other DisplayObjects. BitmapData allows you to work with the pixels of a Bitmap object. Some methods that are fun for working with pixels include:

Rendering with pixels can be much faster in Flash than working with vectors.

Drag and Drop

The easiest way to create a draggable object in actionscript is through the startDrag and stopDrag methods of a Sprite or Movieclip:

It’s common to use these methods in combination with MouseDownMouseMove, and MouseUp.

Collision Detection

Detecting when two objects collide or overlap can be helpful for interfaces and games. Flash supports two methods in the DisplayObject class for detecting collisions between the object and either another object or a point. Objects in flash have a box around them called the boundingBox. The methods determine if that box overlaps either the box of another object or a point.

This week we will also look at how to tie frames of the timeline to actionscript in an external class. To do so, you will want to make sure that your class extends the Movieclip class so that you may use the following methods:

Labels can help organize sections of your timeline as well as free you from relying on specific frame numbers. Instances within your objects should be declared as public properties of your class.

Please refer to the sample files for this class to see how these concepts are pulled together.

download: week 8 samples


  1. Try working with BitmapData with your drawing application
  2. Use collision detection to develop a prototype for a simple interface or game.
    1. You may extend your drawing application to use some collision detection
    2. You try to prototype something new
  3. Foundation in AS 3 Reading:
    1. Ch. 7 (p. 243 – 272)
    2. Ch. 8 (p. 301 – 321)
    3. Will will be working with video and sound and if time permits, the camera and microphone.