O'Reilly logo

The Essential Guide to Physics for Flash Games, Animation, and Simulations by Adrian Dobre, Dev Ramtal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required