The Flash drawing API

The Flash drawing application programming interface (API) allows you to draw things such as basic shapes and fills using ActionScript. Technically, this is possible because all display objects have a graphics property that can access the methods of the drawing API.

Drawing lines and curves

There are four methods that you need to know to be able to draw lines and curves: lineStyle, moveTo, lineTo, and curveTo.

  • The lineStyle(width, color, alpha) method takes three arguments: the width of the line to be drawn, the line color, and its transparency.
  • The moveTo(x, y) method moves the cursor to the specified location (x, y) without drawing anything.
  • The lineTo(x, y) method draws a straight line from the current location to the ...

Get The Essential Guide to Physics for Flash Games, Animation, and Simulations now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.