O'Reilly logo

Professional Adobe® Flex® 3 by Joe Berkovitz, David Hassoun, Andrew Trice, Tom Sugden, Todd Prekaski, Jun Heider, Peter Ent, Joseph Balderson

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

Chapter 25. Dynamic Skinning and the Drawing API

One of the largest differentiators of Flex and the Flash Player from traditional HTML-based Web development technologies is the Drawing API. The Drawing API allows you to programmatically render vector graphics on the screen within the Flash Player, and it is the foundation for dynamic skinning with the Flex framework. This chapter explores the Drawing API — what it is, and some of the things that you can do with it. The chapter also discusses programmatic component skins using the Drawing API, and additional imaging capabilities that the Drawing API provides.

Understanding the Drawing API

When people refer to the Flex and the Flash Player's Drawing API, they are referring to the set of classes that enable you to render vector graphics at runtime. The Drawing API allows you to draw various shapes, including lines and curves, in a programmatic fashion. This allows you to create polygons, or any other geometric shape. The Drawing API also allows you to render any of these shapes with any type of color, line thickness, fill, bitmap, or alpha transparency value.

While this sounds basic, it actually is the fundamental API that enables some very sophisticated component rendering. Most visual components in the Flex framework use the Drawing API to render themselves; they are typically not based on image assets. A Canvas, for example uses programmatic skins using the Drawing API to draw its borders and background colors. The header and control ...

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