Skip to Main Content
Learning ActionScript 3.0, 2nd Edition
book

Learning ActionScript 3.0, 2nd Edition

by Zevan Rosser, Rich Shupe
October 2010
Beginner content levelBeginner
453 pages
15h 52m
English
O'Reilly Media, Inc.
Content preview from Learning ActionScript 3.0, 2nd Edition

Chapter 8. Drawing with Vectors

IN THIS CHAPTER

The Graphics Class

The Geometry Package

9-Slice Scaling

Applied Examples

What’s Next?

Flash is well known for popularizing vector graphics on the Web. Put simply, vectors are composed of mathematically generated points, lines, curves, and shapes and are used to create artwork in computer software. Using vectors is optimal when you need to scale artwork because the vectors remain crisp and clean at any size. By contrast, bitmap graphics pixelate when scaled.

Drawing vectors graphics with code brings with it special benefits. Included among them is the freedom to create assets on the fly, rather than relying solely on art drawn or imported prior to publishing your file. Related to this is the additional bonus of reduced file size, because assets are created at runtime rather than occupying space in your SWF. Smaller files mean less time that your viewers spend waiting for your files to load.

In this chapter, we’ll focus on drawing vectors, the first of two ways to originate visual assets with code. Over the next several pages, we’ll cover:

  • The Graphics Class. This class, often referred to as part of the drawing API, contains methods for drawing vectors. You have control over stroke and fill attributes, and can move a virtual pen around the screen, choosing where to draw lines, curves, and shapes like circles and rectangles.

  • The Geometry Package. This utility package contains classes for creating points and rectangles, as well as transforming objects, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning ActionScript 3.0

Learning ActionScript 3.0

Rich Shupe, Zevan Rosser
ActionScript 3.0 Cookbook

ActionScript 3.0 Cookbook

Joey Lott, Darron Schall, Keith Peters
ActionScript 3.0 Bible

ActionScript 3.0 Bible

Roger Braunstein

Publisher Resources

ISBN: 9781449398705Supplemental ContentErrata Page