Previous Section Table of Contents Next Section

Hacks #14-25

When we say "drawing" in Flash, we can be talking about two different things. The more traditional form of drawing is freehand vector drawing as used by animators who create Flash cartoons. The other type uses scripts to do the drawing for you, something I like to call "kinetic drawing." In kinetic drawing, not only do the graphics themselves move, but you can also create the graphics in real time, and you might display the interim steps to the user for effect. To draw at runtime, we use the so-called Drawing API, which is just a collection of methods of the MovieClip class including lineStyle( ), moveTo( ), lineTo( ), and beginFill( ), which can be used to create strokes and fills.

For the traditional animator, this chapter includes a number of hacks to address common problems, such as reducing the pixelation around the edges of bitmaps [Hack #23] (which allows you to effectively mix bitmaps with vector content, as well as reducing the appearance of jaggies).

The scripter will find a number of fixes to common Flash problems, such as alpha property inaccuracy [Hack #19] and the bitmap "shifting pixel" problem [Hack #24]. We have also included hacky shortcuts to creating common building blocks when you are creating graphic content dynamically with scripts, such as drawing a circle with just a single straight line [Hack #14].

Drawing in Flash is a crucial ability whether you are a scripter or an artist, so the hacks presented should be some of the most accessible for all Flash users. It should come as no surprise to experienced Flashers that several hacks presented here rely on masks. If you are unfamiliar with masks, refer to the introduction to Chapter 1 for a quick primer.

    Previous Section Table of Contents Next Section