Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

35.8. Summary

  • Drawing vector graphics programmatically in Flash Player is performed through the Graphics object.

  • You can't instantiate a Graphics object or put it in the display list. Use the graphics property of a Shape, Sprite, or MovieClip instead.

  • Graphics objects are state machines.

  • Basic path operations include moving the "pen," drawing a straight-line segment, and drawing a curve.

  • To stroke a path, you must first set a line style with lineStyle().

  • Line styles can be followed by stroke fill styles for non-solid-color fills.

  • To fill a path, use begin[kindof]Fill() methods and endFill().

  • Clear the canvas by calling clear().

  • Strokes and fills may be styled with solid colors, gradients, bitmap fills, and shader fills (varies by Flash Player version).

  • Draw primitives with methods like drawRect() and drawCircle().

  • Paths can be stored as lists of command types and coordinates and drawn with drawPath() (varies by Flash Player version).

  • Paths, fills, and strokes can be encapsulated in drawing command objects that implement IGraphicsData and drawn with drawGraphicsData() (varies by Flash Player version).

  • Mapping textures to polygons is possible with drawTriangles() (varies by Flash Player version).


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial